﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Programming By A Tool &#187; Ajax Toolkit</title>
	<atom:link href="http://byatool.com/tag/ajax-toolkit/feed/" rel="self" type="application/rss+xml" />
	<link>http://byatool.com</link>
	<description>This is my recorded stumbling through ASP.Net, Framework 3.5, C# 3.0, Ajax, Javascript, and Love.  Stay, learn, destroy.  It's your life.</description>
	<lastBuildDate>Thu, 03 May 2012 17:28:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Ajax Control Library: Autocomplete Control to Scriptcontrol</title>
		<link>http://byatool.com/ui/ajax-control-library-autocomplete-control-to-scriptcontrol/</link>
		<comments>http://byatool.com/ui/ajax-control-library-autocomplete-control-to-scriptcontrol/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 16:08:06 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Ajax Toolkit]]></category>
		<category><![CDATA[Autocomplete]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[ScriptControl]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=329</guid>
		<description><![CDATA[[Part One] [Part Two] [Part Three] [Part Four] [Part Five] Ok so in part four I showed you how to create a webcontrol from the AutoComplete control, so now it&#8217;s time to take the first four lessons and combine them. Now it&#8217;s time to have an autocomplete script control. The first part is really simple, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://byatool.com/?p=219">[Part One]</a> <a href="http://byatool.com/?p=231">[Part Two]</a> <a href="http://byatool.com/?p=250">[Part Three]</a> <a href="http://byatool.com/?p=244">[Part Four]</a> <a href="http://byatool.com/?p=329">[Part Five]</a></p>
<p>Ok so in <a href="http://byatool.com/?p=244">part four</a> I showed you how to create a webcontrol from the AutoComplete control, so now it&#8217;s time to take the first four lessons and combine them.  Now it&#8217;s time to have an autocomplete script control.   The first part is really simple, just like before you have to:</p>
<ul>
<li>Inherit from ScriptControl</li>
<li>Override the GetScriptDescriptors and GetScriptReferences methods</li>
<li>Create the .js file</li>
<li>Make the .js file an embedded resource</li>
<li>Update the assemblyinfo file in the Properties folder</li>
<li>Add the minimal needed javascript</li>
</ul>
<p>So it will look something like this:</p>
<pre><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #008080;">AutocompleteScriptControl</span> : <span style="color: #008080;">ScriptControl</span>, <span style="color: #008080;">INamingContainer</span>
{
  <span style="color: #0000ff;">private</span> <span style="color: #008080;">AutoCompleteExtender</span> autoComplete;
  <span style="color: #0000ff;">private</span> <span style="color: #008080;">TextBox</span> textboxTarget;

  <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #0000ff;">void</span> CreateChildControls()
  {
    base.CreateChildControls();

    autoComplete = <span style="color: #0000ff;">new</span> <span style="color: #008080;">AutoCompleteExtender</span>();
    autoComplete.ID = <span style="color: #800000;">"autoCompleteMain";</span>

    textboxTarget = <span style="color: #0000ff;">new</span> <span style="color: #008080;">TextBox</span>();
    textboxTarget.ID = <span style="color: #800000;">"textboxTarget"</span>;

    Controls.Add(textboxTarget);
    Controls.Add(autoComplete);
  }

  <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #0000ff;">void</span> OnPreRender(<span style="color: #008080;">EventArgs</span> e)
  {
    base.OnPreRender(e);
    autoComplete.TargetControlID = textboxTarget.ID;
  }

  <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #008080;">IEnumerable&lt;ScriptDescriptor&gt;</span> GetScriptDescriptors()
  {
    <span style="color: #008080;">ScriptControlDescriptor</span> desc =
      <span style="color: #0000ff;">new</span> <span style="color: #008080;">ScriptControlDescriptor</span><span style="color: #800000;">("Test.Examples.Client.AutocompleteScriptControl"</span>, ClientID);
    desc.AddProperty<span style="color: #800000;"><span style="color: #003366;">(</span>"textboxTargetID"</span>, textboxTarget.ClientID);
    desc.AddProperty(<span style="color: #800000;">"autocompleteID"</span>, autoComplete.ClientID);

    <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">new</span> <span style="color: #008080;">ScriptDescriptor</span>[] { desc };
  }

  <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #008080;">IEnumerable</span>&lt;<span style="color: #008080;">ScriptDescriptor</span>&gt; GetScriptReferences()
  {
    <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">new</span> [] { <span style="color: #0000ff;">new</span> <span style="color: #008080;">ScriptReference</span>
      (<span style="color: #800000;">"Test.Examples.AutoCompleteExample.AutocompleteScriptControl.js"</span>, <span style="color: #800000;">"Test.Examples"</span>) };
  }

}</pre>
<p>And the script file:</p>
<pre><span style="color: #0000ff;">if</span> (Type)
{
    Type.registerNamespace(<span style="color: #800000;">"Test.Examples.Client"</span>);
}

Test.Examples.Client.AutocompleteScriptControl = function(element)
{
    Test.Examples.Client.AutocompleteScriptControl.initializeBase(this, [element]);

    <span style="color: #0000ff;">this</span>._autocompleteID = <span style="color: #ff0000;">""</span>;
    <span style="color: #0000ff;">this</span>._textboxTargetID = <span style="color: #ff0000;">""</span>;

    <span style="color: #0000ff;">this</span>._autoComplete = <span style="color: #0000ff;">null</span>;
    <span style="color: #0000ff;">this</span>._textboxTarget = <span style="color: #0000ff;">null</span>;
}

Test.Examples.Client.AutocompleteScriptControl.prototype =
{
    get_autocompleteID: <span style="color: #0000ff;">function</span>()
    {
        <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>._autocompleteID;
    },

    set_autocompleteID: <span style="color: #0000ff;">function</span>(value)
    {
        <span style="color: #0000ff;">this</span>._autocompleteID = value;
    },

    get_textboxTargetID: <span style="color: #0000ff;">function</span>()
    {
        <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>._textboxTargetID;
    },

    set_textboxTargetID: <span style="color: #0000ff;">function</span>(value)
    {
        <span style="color: #0000ff;">this</span>._textboxTargetID = value;
    },

    initialize: <span style="color: #0000ff;">function</span>()
    {
        <span style="color: #0000ff;">this</span>._autoComplete = $get(<span style="color: #0000ff;">this</span>._autocompleteID);
        <span style="color: #0000ff;">this</span>._textboxTarget = $get(<span style="color: #0000ff;">this</span>._textboxTargetID);

        Test.Examples.Client.AutocompleteScriptControl.callBaseMethod(<span style="color: #0000ff;">this</span>, <span style="color: #ff0000;">'initialize'</span>);
    },

    dispose: function()
    {
        Test.Examples.Client.AutocompleteScriptControl.callBaseMethod(<span style="color: #0000ff;">this</span>, <span style="color: #ff0000;">'dispose'</span>);
    }
}

/***********************************/

Test.Examples.Client.AutocompleteScriptControl.registerClass
    (<span style="color: #ff0000;">'Test.Examples.Client.AutocompleteScriptControl'</span>, Sys.UI.Control);</pre>
<p>And now this is the bare minimum needed to get this done.</p>
]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/ajax-control-library-autocomplete-control-to-scriptcontrol/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make an Autocomplete Control a Webcontrol</title>
		<link>http://byatool.com/ui/ajax-control-toolkit-autocomplete-control-webcontrols-createchildcontrols-and-you/</link>
		<comments>http://byatool.com/ui/ajax-control-toolkit-autocomplete-control-webcontrols-createchildcontrols-and-you/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 00:44:54 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Ajax Toolkit]]></category>
		<category><![CDATA[Autocomplete]]></category>
		<category><![CDATA[WebControl]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=244</guid>
		<description><![CDATA[[Part One] [Part Two] [Part Three] [Part Four] [Part Five] So in the last post I showed the easy way to use the Toolkit Autocomplete control, but it might have left you with some questions like: Do I have to keep adding a textbox everytime I want an autocomplete control? Is there an easy way [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://byatool.com/?p=219">[Part One]</a> <a href="http://byatool.com/?p=231">[Part Two]</a> <a href="http://byatool.com/?p=250">[Part Three]</a> <a href="http://byatool.com/?p=244">[Part Four]</a> <a href="http://byatool.com/?p=329">[Part Five]</a></p>
<p>So in the last post I showed the easy way to use the Toolkit Autocomplete control, but it might have left you with some questions like:  Do I have to keep adding a textbox everytime I want an autocomplete control?  Is there an easy way to make a composite control?  Is this guy an idiot?</p>
<p>The easy answer is: yes.</p>
<p>Now I&#8217;m not a huge fan of making web project controls (.ascx) unless there is heavy style formatting.  For the most part if its going to be usable somewhere else and it is fairly simple to represent codewise, I&#8217;ll put it in a class library as a WebControl or ScriptControl.  So how is this done with the autocomplete?</p>
<p>For my examples, I&#8217;ll be using the same root namespace as the Script Control examples, namely Test.Examples.AutoCompleteExample. Now that I have a wonderful folder created I&#8217;m going to go ahead and create a WebControl Class named AutoCompleteControl.</p>
<p>Now when I create this new control there are some things I will need:<br />
-Has to inherit from at least WebControl (ScriptControl example I will do later)<br />
-Has to have a textbox (The autocomplete needs a target control)<br />
-I would strongly suggest a certain amount of properties to be exposed, basically reflecting the properties on the autocomplete<br />
-I added the implementing of ITextControl mainly to relfect a .Text property but that isn&#8217;t really needed. I just found this useful if you end up treating this control like a textbox for say validation purposes.</p>
<pre>    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #33cccc;">AutoCompleteControl</span> : <span style="color: #33cccc;">WebControl</span>, <span style="color: #33cccc;">INamingContainer</span>
    {
        <span style="color: #0000ff;">private</span> <span style="color: #33cccc;">AutoCompleteExtender</span> autoComplete;
        <span style="color: #0000ff;">private</span> <span style="color: #33cccc;">TextBox</span> textboxTarget;

        <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #0000ff;">void</span> CreateChildControls()
        {
            base.CreateChildControls();

            autoComplete = <span style="color: #0000ff;">new</span> <span style="color: #33cccc;">AutoCompleteExtender</span>();
            autoComplete.ID = <span style="color: #800000;">"autoCompleteMain"</span>;

            textboxTarget = <span style="color: #0000ff;">new</span> <span style="color: #33cccc;">TextBox</span>();
            textboxTarget.ID = <span style="color: #800000;">"textboxTarget"</span>;

            Controls.Add(textboxTarget);
            Controls.Add(autoComplete);
        }

        <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #0000ff;">void</span> OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            autoComplete.TargetControlID = textboxTarget.ID;

            autoComplete.CompletionInterval = 5000;
            autoComplete.EnableCaching = EnableCaching;
            autoComplete.CompletionSetCount = CompletionSetCount;
            autoComplete.MinimumPrefixLength = MinimumPrefixLength;
            autoComplete.OnClientItemSelected = OnClientItemSelected;
            autoComplete.ServiceMethod = ServiceMethod;
            autoComplete.ServicePath = ServicePath;
        }

        <span style="color: #0000ff;">public</span> <span style="color: #33cccc;">Int32</span> CompletionSetCount { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }

        <span style="color: #0000ff;">public</span> <span style="color: #33cccc;">Boolean</span> EnableCaching { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }

        <span style="color: #0000ff;">public</span> <span style="color: #33cccc;">Int32</span> MinimumPrefixLength { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }

        <span style="color: #0000ff;">public</span> <span style="color: #33cccc;">String</span> OnClientItemSelected { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }

        <span style="color: #0000ff;">public</span> <span style="color: #33cccc;">String</span> ServiceMethod { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }

        <span style="color: #0000ff;">public</span> <span style="color: #33cccc;">String</span> ServicePath { <span style="color: #0000ff;">get</span>; <span style="color: #0000ff;">set</span>; }

        <span style="color: #0000ff;">public</span> <span style="color: #33cccc;">String</span> Text
        {
            <span style="color: #0000ff;">get</span>
            {
                EnsureChildControls();
                <span style="color: #0000ff;">return</span> textboxTarget.Text;
            }
            <span style="color: #0000ff;">set</span>
            {
                EnsureChildControls();
                textboxTarget.Text = <span style="color: #0000ff;">value</span>;
            }
        }
    }</pre>
<p>Well hell that was easy, wasn&#8217;t it? All I had to do is create the class, add the textbox and autocomplete as controls, and set a few properties. Voila, we now have a working autocomplete control. Now if you had read the last post on this (Page 3) then you might have noticed this new property:</p>
<p>CompletionInterval</p>
<p>What is that? Well apparently it deals with the amount of time a particular item is highlighted when hovering over it. Found this out the other day. SURPRISE!!</p>
<p>Couple of points from this:</p>
<p>Why?<br />
- Well if nothing else, you now have a compostite control to use. The markup will supply the service location and the method to use, everything else is taken care of with this control.</p>
<p>- On top of that, this can now be snug in a class library (assembly) for reuse thus removing it&#8217;s need to be recopied everytime you need it in another web project.</p>
<p>- You can now inherit from this control to add fucntionality if you need.</p>
<p>- You can now convert this to a script control in order to access javascript events and other fun things.</p>
<p>So as you can see, this is a pretty good way to go.</p>
<p>Something else of note is the CreateChildControls/EnsureChildControls situation. CreateChildControls is a overridable method that is used to make sure that the controls themselves are created and handled. The nice thing about this is that you won&#8217;t run into the timing issues you might if you try to initialize controls in other methods like OnInit. Also, it allows you the use of the EnsureChildControls method. When this method is called, the CreateChildControls method is either called or not depending if it&#8217;s already been run. EnsureChildControls basically asks if CreateChildControls has been run. If it has then it doesn&#8217;t call it again, if it hasn&#8217;t then the method is called to create the controls. So as you can see, this makes it easy to guarantee that the controls have been created in order to access them. This becomes important with properties that are tied to controls as there is no guarantee that when a property is accessed the controls aren&#8217;t null. Kind of nice, huh?</p>
<p>Also you might have noticed that I set all the control properties that were &#8220;attached&#8221; to the autocomplete in prerender. Usually for safety, I don&#8217;t both setting any outward facing properties like that until prerender so that I know I have the latest and greatest values.</p>
<p>Just incase you needed the markup example:</p>
<pre>&lt;%@ <span style="color: #800000;">Register</span> <span style="color: #ff0000;">Assembly</span><span style="color: #3366ff;">="Test.Examples"
</span>  <span style="color: #ff0000;">Namespace</span><span style="color: #3366ff;">="Test.Examples.AutoCompleteExample"</span> <span style="color: #ff0000;">TagPrefix</span><span style="color: #3366ff;">="test"</span> %&gt;

&lt;<span style="color: #800000;">test:AutoCompleteControl</span> <span style="color: #ff0000;">ID</span><span style="color: #3366ff;">="autoCompleteTest"</span> <span style="color: #ff0000;">runat</span><span style="color: #3366ff;">="server"</span>
  <span style="color: #ff0000;">ServicePath</span><span style="color: #3366ff;">="~/Service/AutocompleteWebControl.svc"</span> <span style="color: #ff0000;">ServiceMethod</span><span style="color: #3366ff;">="GetUserNameList"</span>
  <span style="color: #ff0000;">CompletionSetCount</span><span style="color: #3366ff;">="10"</span> <span style="color: #ff0000;">MinimumPrefixLength</span><span style="color: #3366ff;">="1"</span> /&gt;</pre>
<p>HOLY SMOKES NO NEED FOR TEXTBOXES!!11</p>
<pre>  <span style="color: #0000ff;">using</span> System.Web.UI;
  <span style="color: #0000ff;">using</span> System.Web.UI.WebControls;
  <span style="color: #0000ff;">using</span> AjaxControlToolkit;</pre>
]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/ajax-control-toolkit-autocomplete-control-webcontrols-createchildcontrols-and-you/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Ajax Control Toolkit Autocomplete &#8211; How to use&#8230; simple example.</title>
		<link>http://byatool.com/ui/ajax-control-toolkit-autocomplete-how-to-use-simple-example/</link>
		<comments>http://byatool.com/ui/ajax-control-toolkit-autocomplete-how-to-use-simple-example/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 15:06:12 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Ajax Toolkit]]></category>
		<category><![CDATA[Autocomplete]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=250</guid>
		<description><![CDATA[[Part One] [Part Two] [Part Three] [Part Four] [Part Five] So in my journey to create an autocomplete control, I had it working except something really screwy with the stylesheet and how to make it look&#8230; oh I don&#8217;t know&#8230; not hideous. So on a whim I decided to give the Ajax Control Toolkit Autocomplete [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://byatool.com/?p=219">[Part One]</a> <a href="http://byatool.com/?p=231">[Part Two]</a> <a href="http://byatool.com/?p=250">[Part Three]</a> <a href="http://byatool.com/?p=244">[Part Four]</a> <a href="http://byatool.com/?p=329">[Part Five]</a></p>
<p>So in my journey to create an autocomplete control, I had it working except something really screwy with the stylesheet and how to make it look&#8230; oh I don&#8217;t know&#8230; not hideous. So on a whim I decided to give the <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx">Ajax Control Toolkit Autocomplete</a> a try. I figured that if so many other people use it, why shouldn&#8217;t I? Or when properly translated: I hate dealing with style sheet issues and someone already had a control that works in both Firefox and IE.</p>
<p><strong>Introduction&#8230; Skip if you know what this is already and just want the stupid code.</strong></p>
<p>So where to begin? Well the autocomplete control itself is free and comes along with the Toolkit assembly.</p>
<p>Sounds good so far, so what does it do? It&#8217;s a &#8220;control&#8221;, for lack of a better word&#8230; more on that later, that can be used to attach to a textbox and allow a user to type in parts of a word and get back dropdown list like item&#8230; list.</p>
<p>Pretty good huh? What&#8217;s the catch? Well basically you need to use a web service to work with it, meaning either old school (.asmx?) or new school Communication Foundation services. For this example I will actually be doing it the &#8220;hard&#8221; way and use WCF. I&#8217;ve done it with both, but I figure I might as make it the more difficult of the two for fun. If I remember, the old web services are really easy to do this with. Another catch is that the web service has to be on the same server as the project.</p>
<p>So what isn&#8217;t it? End of world hunger, world peace, or the meaning of life. Sorry, I can only give you one of those and the autocomplete doesn&#8217;t cover that subject.</p>
<p><strong>End Introduction and Begin the stupid code</strong></p>
<p>Ok so you want to use the autocomplete control, huh? Well, you&#8217;ve come to the right place.</p>
<p>For this example, I&#8217;ll be doing the most simple version of adding the autocomplete control. This basically means setting up the service and creating some markup. Really easy. Next post I will get into how to create a web control class in a non web assembly.</p>
<p>Right off the bat you&#8217;ll need the toolkit assembly and create a project reference to it. Next you have to set up the WCF Service which is actually a lot easier than it sounds? Why? Because Microsoft was nice enough to create a default one for us. I&#8217;ve created a folder named Service (Brilliant!) and then I right clicked and chose Add New Item -&gt; Ajax-Enabled WCF Service (I called it AutocompleteWebControl)&#8230; and boom already almost there.</p>
<p>You should now have a AutocompleteWebControl.svc.cs file in the folder and if you look at the code you get this:</p>
<pre><span style="color: #0000ff;">namespace</span> Test.Frontend.Service
{
    [<span style="color: #33cccc;">ServiceContract</span>(Namespace = <span style="color: #800000;">""</span>)]
    [<span style="color: #33cccc;">AspNetCompatibilityRequirements</span>(RequirementsMode =
      <span style="color: #33cccc;">AspNetCompatibilityRequirementsMode</span>.Allowed)]
    <span style="color: #0000ff;">public class</span> AutocompleteWebControl
    {
        <span style="color: #008000;">// Add [WebGet] attribute to use HTTP GET
</span>        [<span style="color: #33cccc;">OperationContract</span>]
        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> DoWork()
        {
            <span style="color: #008080;"><span style="color: #008000;">// Add your operation implementation here</span>
</span>            <span style="color: #0000ff;">return</span>;
        }
    }
}</pre>
<p>Only thing of real importance at this point is the method with the [OperationContract] attribute. If you are going to expose a method to the autocomplete it has to have this tag. Now as you can see, we&#8217;ll need a method. At this point though I have to note two things that for the method to be correct:</p>
<ul>
<li>It has to take in a String and an Integer. The first is the string that the user has typed in to search on, the second (If you choose to use it) is for limiting the number of items back. (This is set by the CompletionSetCount property on the control, more on this later.)</li>
<li>The second thing is that without any changes to how the control works, you have to send back a list of strings. This could be a deal breaker if you need to send back more information. I think it&#8217;s possible to do so, but I haven&#8217;t gotten to that point yet.</li>
</ul>
<p>Ok so let&#8217;s create a quick method. My example is using the typical Linq to Sql stuff I&#8217;ve been using but I have faith you can figure out how to get some kind of needed information whether it&#8217;s LInq to Sql, NHibernate, LLBLGEN, or Stored Procedures&#8230;</p>
<pre>....
  [<span style="color: #33cccc;">OperationContract</span>]
  <span style="color: #0000ff;">public</span> <span style="color: #33cccc;">String</span>[] GetUserNameList(<span style="color: #33cccc;">String</span> prefixText, <span style="color: #33cccc;">Int32</span> count)
  {
    <span style="color: #33cccc;">String</span>[] userNames;

    userNames = LinqData.DataClasses.<span style="color: #33cccc;">User</span>
        .GetUserListByLikeName(prefixText)
        .Select(currentUser =&gt; currentUser.UserName)
        .ToArray();

    <span style="color: #0000ff;">return</span> userNames;
  }
....</pre>
<p>Now I didn&#8217;t use the passed in integer, but I didn&#8217;t need it for this situation. As you can see this method, however follows the two rules: Takes in a string and integer and returns a string array.</p>
<p>Now you have the servce set up, next up is the mark up and let me tell you, it&#8217;s freakishly hard.</p>
<pre>&lt;%@ <span style="color: #800000;">Register</span> <span style="color: #ff0000;">assembly</span><span style="color: #3366ff;">="AjaxControlToolkit"</span> <span style="color: #ff0000;">namespace</span><span style="color: #3366ff;">="AjaxControlToolkit"
</span>tagPrefix<span style="color: #3366ff;">="controlkit"</span> %&gt;

&lt;<span style="color: #800000;">asp:ScriptManager</span> <span style="color: #ff0000;">ID</span><span style="color: #3366ff;">="smMain"</span> <span style="color: #ff0000;">runat</span><span style="color: #3366ff;">="server"</span> /&gt;
&lt;<span style="color: #800000;">asp:TextBox</span> <span style="color: #ff0000;">ID</span><span style="color: #3366ff;">="textboxTarget"</span> <span style="color: #ff0000;">runat</span><span style="color: #3366ff;">="server"</span> /&gt;
&lt;<span style="color: #800000;">ajax:AutoCompleteExtender</span> <span style="color: #ff0000;">ID</span><span style="color: #3366ff;">="autoCompleteMain"</span> <span style="color: #ff0000;">runat</span><span style="color: #3366ff;">="server"</span>
  <span style="color: #ff0000;">ServicePath</span><span style="color: #3366ff;">="~/Service/AutocompleteWebControl.svc"</span> <span style="color: #ff0000;">ServiceMethod</span><span style="color: #3366ff;">="GetUserNameList"</span>
  <span style="color: #ff0000;">CompletionSetCount</span><span style="color: #3366ff;">="10"</span> <span style="color: #ff0000;">MinimumPrefixLength</span><span style="color: #3366ff;">="1"</span> <span style="color: #ff0000;">TargetControlID</span><span style="color: #3366ff;">="textboxTarget"</span> /&gt;</pre>
<p>So there it is. Now you have a working autocomplete. But just in case you need it, I&#8217;ll run through this stuff.</p>
<p><span style="color: #ff0000;">ServicePath</span> &#8211; This is where the web service is &#8220;located&#8221; relative to the project.</p>
<p><span style="color: #ff0000;">ServiceMethod</span> &#8211; This is the name of the method it will call to fill itself.</p>
<p><span style="color: #ff0000;">CompletionSetCount</span> &#8211; This is the other parameter passed into the web method and used if you want to limit the count of items returned.</p>
<p><span style="color: #ff0000;">MinimumPrefixLength</span> &#8211; The minimum amount of characters needed to trigger the method call.</p>
<p><span style="color: #ff0000;">TargetControlID</span> &#8211; Come on, honestly? You can&#8217;t figure that one out?</p>
<p>At this point you&#8217;re thinking this is great and all but what if you want to make a composite control? Well that&#8217;s the next post and it&#8217;s fairly easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/ajax-control-toolkit-autocomplete-how-to-use-simple-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Handle Events and Add Controls to Script Controls (ASP.Net ScriptControl)</title>
		<link>http://byatool.com/ui/aspnet-script-controls-adding-controls-and-handling-events/</link>
		<comments>http://byatool.com/ui/aspnet-script-controls-adding-controls-and-handling-events/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 22:18:00 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Ajax Toolkit]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[ScriptControl]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=231</guid>
		<description><![CDATA[[Part One] [Part Two] [Part Three] [Part Four] [Part Five] Ok in the last post I went over the creation of a web control. Simple enough as you can see. Now it&#8217;s time to screw around with Controls and how to capture their events client side. Something only a brilliant person like me could figure [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://byatool.com/?p=219">[Part One]</a> <a href="http://byatool.com/?p=231">[Part Two]</a> <a href="http://byatool.com/?p=250">[Part Three]</a> <a href="http://byatool.com/?p=244">[Part Four]</a> <a href="http://byatool.com/?p=329">[Part Five]</a></p>
<p>Ok in the last post I went over the creation of a web control.  Simple enough as you can see.  Now it&#8217;s time to screw around with Controls and how to capture their events client side.  Something only a brilliant person like me could figure out&#8230;  I so wish that were true.  I could make millions.</p>
<p>Let&#8217;s add a control to the eh&#8230; control. Say we want to throw an alert everytime a person focuses on a textbox. Yes, that&#8217;s really stupid but it&#8217;s easy so live with it. Let&#8217;s use the class from the other post:</p>
<pre>  <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #33cccc;">ScriptControlExample</span> : <span style="color: #33cccc;">ScriptControl</span> , <span style="color: #33cccc;">INamingContainer</span>
  {
     <span style="color: #0000ff;">private</span> TextBox textboxStupid;

     <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #0000ff;">void</span> CreateChildControls()
     {
       base.CreateChildControls();

       textboxStupid = new TextBox();
       textboxStupid.ID = "textboxStupid";
       Controls.Add(textboxStupid);
     }

      <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #33cccc;">IEnumerable</span>&lt;<span style="color: #33cccc;">ScriptDescriptor</span>&gt; GetScriptDescriptors()
      {
        <span style="color: #33cccc;">ScriptControlDescriptor</span> desc = <span style="color: #0000ff;">new</span> <span style="color: #33cccc;">ScriptControlDescriptor</span>
          (<span style="color: #800000;">"Test.Examples.Client.ScriptControlExample"</span>, ClientID);
        desc.AddProperty(<span style="color: #800000;">"textboxStupid"</span>, textboxStupid.ClientID);

        <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">new</span> <span style="color: #33cccc;">ScriptDescriptor</span>[] { desc };
      }

      <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #33cccc;">IEnumerable</span>&lt;<span style="color: #33cccc;">ScriptReference</span>&gt; GetScriptReferences()
      {
         <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">new</span> <span style="color: #33cccc;">ScriptReference</span>[] { <span style="color: #0000ff;">new</span> ScriptReference
           (<span style="color: #800000;">"Test.Examples.ScriptControlTemplate.ScriptControlExample.js"</span>, <span style="color: #800000;">"Test.Examples"</span>) };
      }
    }</pre>
<p>Notice anything new? I added a textbox, created it in the CreateChildControls method, then added soemthing new to the GetScriptDescriptors method. Remeber the GetScriptDescriptors method is used to send values to the client from the server. Here I am sending the clientID of the textbox&#8230; can you guess why? That&#8217;s right, because I&#8217;m going to use it to find the control client side. Now for the JavaScript end.</p>
<pre>  <span style="color: #0000ff;">if</span> (Type)
  {
    Type.registerNamespace(<span style="color: #800000;">"Test.Examples.Client"</span>);
  }

  NDI.WebControls.Client.GenericAutoComplete = <span style="color: #0000ff;">function</span>(element)
  {
      NDI.WebControls.Client.GenericAutoComplete.initializeBase(<span style="color: #0000ff;">this</span>, [element]);

      <span style="color: #008000;">//Textbox ID value</span>
      <span style="color: #0000ff;">this</span>._textboxStupidID = <span style="color: #800000;">""</span>;
      <span style="color: #008000;">//Textbox Control</span>
      <span style="color: #0000ff;">this</span>._textboxStupid = <span style="color: #0000ff;">null</span>;
      <span style="color: #008000;">//Event Handler</span>
      <span style="color: #0000ff;">this</span>._textboxStupidOnFocus = <span style="color: #0000ff;">null</span>;
  }

  Test.Examples.Client.ScriptControlExample.prototype =
  {
    <span style="color: #008000;">//Properties for the _textboxStupidID field</span>
    get_textboxStupidID : <span style="color: #0000ff;">function</span>()
    {
        <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">this</span>._textboxStupidID;
    },

    set_textboxStupidID : <span style="color: #0000ff;">function</span>(value)
    {
        <span style="color: #0000ff;">this</span>._textboxStupidID = value;
    },

    <span style="color: #008000;">//Method to be called on focus</span>
    handleOnTextBoxFocus : <span style="color: #0000ff;">function</span>(e)
    {
        alert(<span style="color: #800000;">'hi'</span>);
    },    

     initialize: <span style="color: #0000ff;">function</span>()
    {
        <span style="color: #008000;">//Find and set the textbox field using the passed in ID</span>
        <span style="color: #0000ff;">this</span>._textboxStupid = $get(<span style="color: #0000ff;">this</span>._textboxStupidID);

        <span style="color: #008000;">//Create a delegate to handle the onFocus event</span>
        <span style="color: #008000;">//Basically creating a means to call the handleOnTextBoxFocus method</span>
        <span style="color: #0000ff;">this</span>._textboxStupidOnFocus = Function.createDelegate(<span style="color: #0000ff;">this</span>, <span style="color: #0000ff;">this</span>.handleOnTextBoxFocus);

        <span style="color: #008000;">//Set the onFocus event to be handled</span>
        $addHandler(<span style="color: #0000ff;">this</span>._textboxStupid, <span style="color: #800000;">"focus"</span>, <span style="color: #0000ff;">this</span>._textboxStupidOnFocus);

        Test.Examples.Client.ScriptControlExample.callBaseMethod(<span style="color: #0000ff;">this</span>, <span style="color: #800000;">'initialize'</span>);
    },

    dispose: <span style="color: #0000ff;">function</span>()
    {
        <span style="color: #008000;">//Remove the event handling when this is all said and done.  A clean up.
</span>        $removeHandler(<span style="color: #0000ff;">this</span>._textboxStupid, <span style="color: #800000;">"focus"</span>, <span style="color: #0000ff;">this</span>._textboxStupidOnFocus);
        Test.Examples.Client.ScriptControlExample.callBaseMethod(<span style="color: #0000ff;">this</span>, <span style="color: #800000;">'dispose'</span>);
    }
  }
  <span style="color: #008000;">//Same as before
</span>  Test.Examples.Client.ScriptControlExample.registerClass(
    <span style="color: #800000;">'Test.Examples.Client.ScriptControlExample'</span>, Sys.UI.Control);</pre>
<p>Oooooooooook So some added things, yes? Well I&#8217;ll go through them:</p>
<pre>  NDI.WebControls.Client.GenericAutoComplete = <span style="color: #0000ff;">function</span>(element)
  {
      NDI.WebControls.Client.GenericAutoComplete.initializeBase(<span style="color: #0000ff;">this</span>, [element]);

      <span style="color: #008000;">//Textbox ID value
</span>      <span style="color: #0000ff;">this</span>._textboxStupidID = <span style="color: #800000;">""</span>;
      <span style="color: #008000;">//Textbox Control
</span>      <span style="color: #0000ff;">this</span>._textboxStupid = <span style="color: #0000ff;">null</span>;
      <span style="color: #008000;">//Event Handler</span>
      <span style="color: #0000ff;">this</span>._textboxStupidOnFocus = null;
  }</pre>
<p>This is basically declaring the fields for the class and setting their defaults. For this example we&#8217;ll need the field to hold the ID in, a field to represent the textbox oject, and a field to represent the delegate later on used to hook up the onFocus Event.</p>
<p>Note:  In the next bit you will notice that every method/property is followed by a comma.  Do not forget that.</p>
<p>Next, let&#8217;s look at the actual class definition. First we&#8217;ll start at the properties:</p>
<pre>  Test.Examples.Client.ScriptControlExample.prototype =
  {
    <span style="color: #008000;">//Properties for the _textboxStupidID field
</span>    get_textboxStupidID : <span style="color: #0000ff;">function</span>()
    {
        return <span style="color: #0000ff;">this</span>._textboxStupidID;
    },  <span style="color: #008000;">//SEE COMMA
</span>
    set_textboxStupidID : <span style="color: #0000ff;">function</span>(value)
    {
        <span style="color: #0000ff;">this</span>._textboxStupidID = value;
    },  <span style="color: #008000;">//ANOTHER COMMA</span>

    .....</pre>
<p>First thing you&#8217;ll notice is the :fuction notation. This is used to declare both methods and properties. Nothing huge, just something to note.</p>
<p>Second thing you might notice is that the property names look a little hard coded and you would be right. Remember how the value send out from the class file was named &#8220;textboxStupidID&#8221;? Well guess what, for .net to be able to attach that value to a client property, you have to name the properties exactly the same with with either get_ or set_ preceding. Not perfect, but since I&#8217;m the only perfect thing in existence, I guess it will have to do.</p>
<p>Now onto the method we need:</p>
<pre>    ....

    <span style="color: #008000;">//Method to be called on focus</span>
    handleOnTextBoxFocus : <span style="color: #0000ff;">function</span>(e)
    {
        alert(<span style="color: #800000;">'hi'</span>);
    },  

    ....</pre>
<p>Wow&#8230; uh well it&#8217;s a method and it takes in an argument. What the hell do you want from me?</p>
<p>Onto the intialization/Constructorish thing:</p>
<pre>     initialize: <span style="color: #0000ff;">function</span>()
    {
        <span style="color: #008000;">//Find and set the textbox field using the passed in ID</span>
        <span style="color: #0000ff;">this</span>._textboxStupid = $get(<span style="color: #0000ff;">this</span>._textboxStupidID);

        <span style="color: #008000;">//Create a delegate to handle the onFocus event
</span>        <span style="color: #008000;">//Basically creating a means to call the handleOnTextBoxFocus method</span>
        <span style="color: #0000ff;">this</span>._textboxStupidOnFocus = Function.createDelegate(<span style="color: #0000ff;">this</span>, <span style="color: #0000ff;">this</span>.handleOnTextBoxFocus);

        <span style="color: #008000;">//Set the onFocus event to be handled</span>
        $addHandler(<span style="color: #0000ff;">this</span>._textboxStupid, "focus", <span style="color: #0000ff;">this</span>._textboxStupidOnFocus);

        Test.Examples.Client.ScriptControlExample.callBaseMethod(this, 'initialize');
    },</pre>
<p>This might be the least easy part of the whole thing. The first commentented area:</p>
<pre>    <span style="color: #0000ff;">this</span>._textboxStupid = $get(<span style="color: #0000ff;">this</span>._textboxStupidID);</pre>
<p>Simple just gets the textbox by the passed in ID. I swear this will get more complicated.</p>
<pre>    <span style="color: #0000ff;">this</span>._textboxStupidOnFocus = Function.createDelegate(<span style="color: #0000ff;">this</span>, <span style="color: #0000ff;">this</span>.handleOnTextBoxFocus);</pre>
<p>This gives a variable that points to the method we want to use when the focus event fires. Still waiting for complicated&#8230;</p>
<pre>   $addHandler(<span style="color: #0000ff;">this</span>._textboxStupid, <span style="color: #800000;">"focus"</span>, <span style="color: #0000ff;">this</span>._textboxStupidOnFocus);</pre>
<p>This assigns the method we want, through the delegate, to the focus event on the textbox. Hrm. Ok so not really complicated. Just messy looking. One this to note though is that the events on all the controls won&#8217;t have the &#8220;on&#8221; prefix. So if you can&#8217;t figure out why you&#8217;re getting an error because it can&#8217;t find the event, try dropping the &#8220;on&#8221;.</p>
<p>And there you have it. Now you are free to run it and be really annoyed by how dumb this example was.  Next will be using this for the power of evil by adding an autocomplete control with a processing image.</p>
]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/aspnet-script-controls-adding-controls-and-handling-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Script Controls And Love (ASP.Net ScriptControl)</title>
		<link>http://byatool.com/ui/creating-script-controls-and-love/</link>
		<comments>http://byatool.com/ui/creating-script-controls-and-love/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 21:16:08 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Ajax Toolkit]]></category>
		<category><![CDATA[ScriptControl]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=219</guid>
		<description><![CDATA[[Part One] [Part Two] [Part Three] [Part Four] [Part Five] So this will be the first of a couple posts having to do with Script Controls, the Ajax Control Tool Kit AutoComplete control, and Javascript. Now to get started, what&#8217;s a script control? I&#8217;m glad you asked. Basically have you ever created a user control [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://byatool.com/?p=219">[Part One]</a> <a href="http://byatool.com/?p=231">[Part Two]</a> <a href="http://byatool.com/?p=250">[Part Three]</a> <a href="http://byatool.com/?p=244">[Part Four]</a> <a href="http://byatool.com/?p=329">[Part Five]</a></p>
<p>    So this will be the first of a couple posts having to do with Script Controls, the Ajax Control Tool Kit AutoComplete control, and Javascript.  Now to get started, what&#8217;s a script control?</p>
<p>    I&#8217;m glad you asked.  Basically have you ever created a user control that required Javascript to go along with it?  What if the control was in another assembly?  Oh woe is you.  Well you could require the .js file to be placed in the web project and included on the page.  Meh.  OR you could use a script control YAY!  How does that help?  Well it allows you to &#8220;attach&#8221; a javascript file to a control in a class library, no includes needed.  Not only that, but you can pass values from the control to the client and use them with Javascript.  (This includes ids of controls in the control.)</p>
<p>So what&#8217;s needed?  Well&#8230;<br />
1. Create a class library, Call it Test and make the default Namespace Test.Examples</p>
<p>2. Create a folder to hold the class file and the JavaScript file. Let&#8217;s call it ScriptControlTemplate for now.</p>
<p>2.  Create the control class file and the needed JavaScript file. Call them both ScriptControlExample. (For right now it will be easier if they have the same name but they don&#8217;t have to be.)</p>
<p>3. Right click the JavaScript Files -&lt; Properties -&lt; Build Action: Embedded Resource</p>
<p>4. Go to the Properties folder in the class Library and open the AssemblyInfo.cs. Add this line:</p>
<pre>[<span style="color: #0000ff;">assembly</span>: <span style="color: #33cccc;">WebResourceAttribute</span>
    (<span style="color: #800000;">"Test.ScriptControlTemplate.ScriptControlExample.js"</span>, <span style="color: #800000;">"text/javascript"</span>)]</pre>
<p>    Now you might notice something, that almost looks like the actual folder location and it kind of is. In order for this line to work, it has to match the folder location like when Visual Studios creates a Namespace automatically. It uses the directory name as the final part of the namespace. Although to note, the Namespace of the class DOES NOT have to match this. It just has to reflect the directory structure of where the .js file is.</p>
<p>    Ok so now we have a blank .cs file and a blank .js file. Woo hoo. Now what? Well first you need to have the class inherit from System.Web.UI.ScriptControl and override two protected methods</p>
<pre>    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #33cccc;">ScriptControlExample</span> : <span style="color: #33cccc;">ScriptControl</span> , <span style="color: #33cccc;">INamingContainer</span>
    {
        <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #33cccc;">IEnumerable</span>&lt;<span style="color: #33cccc;">ScriptDescriptor</span>&gt; GetScriptDescriptors()
        {
            <span style="color: #33cccc;">ScriptControlDescriptor</span> desc =
                 <span style="color: #0000ff;">new</span> <span style="color: #33cccc;">ScriptControlDescriptor</span>(<span style="color: #800000;">"Test.Examples.Client.ScriptControlExample"</span>, ClientID);
        }

        <span style="color: #0000ff;">protected</span> <span style="color: #0000ff;">override</span> <span style="color: #33cccc;">IEnumerable</span>&lt;<span style="color: #33cccc;">ScriptReference</span>&gt; GetScriptReferences()
        {
          <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">new</span> ScriptReference[] {
              <span style="color: #0000ff;">new</span> <span style="color: #33cccc;">ScriptReference</span>(<span style="color: #800000;">"Test.Examples.ScriptControlTemplate.ScriptControlExample.js"</span>, <span style="color: #800000;">"Test.Examples"</span>) };

        }
    }</pre>
<p>    Ok so I cheated a little and put in two lines that you will need anyhow. I figured it would save some time, mainly mine. Cause let&#8217;s face it, I don&#8217;t really care about yours.</p>
<p>    The first method GetScriptDescriptors is where we will be putting any values we want to send to the Client. The second just tells the system where the JavaScript file is to load. For now you won&#8217;t be doing anything with the second.</p>
<p>    Ok now on to the Javascript file. Basically you have some cannon methods to add just to get the thing to work, and I&#8217;ll be honest: It&#8217;s extremely complicated and you probably won&#8217;t be smart enough to figure it out.</p>
<pre>//Set the namespace
<span style="color: #0000ff;">if</span> (Type)
{
    Type.registerNamespace(<span style="color: #800000;">"Test.Examples.Client"</span>);
}

<span style="color: #339966;">//Won't be doing much with this for the examples I have
</span>Test.Examples.Client.ScriptControlExample = <span style="color: #0000ff;">function</span>(element)
{
    Test.Examples.Client.ScriptControlExample.initializeBase(<span style="color: #0000ff;">this</span>, [element]);
}

<span style="color: #008000;">//This is where you basically define the class
</span>Test.Examples.Client.ScriptControlExample.prototype =
{
    //Where you want to place constructor like code
    initialize: <span style="color: #0000ff;">function</span>()
    {
        Test.Examples.Client.ScriptControlExample.callBaseMethod(<span style="color: #0000ff;">this</span>, <span style="color: #800000;">'initialize'</span>);
    },

    <span style="color: #008000;">//Remove events and such here
</span>    dispose: <span style="color: #0000ff;">function</span>()
    {
        Test.Examples.Client.ScriptControlExample.callBaseMethod(<span style="color: #0000ff;">this</span>, <span style="color: #800000;">'dispose'</span>);
    }
}
Test.Examples.Client.ScriptControlExample.registerClass(<span style="color: #800000;">'Test.Examples.Client.ScriptControlExample'</span>,
   Sys.UI.Control);</pre>
<p>   Phew that was complicated right?</p>
<p>    Ok so now you have what you need to create a script control. Run it and well nothing will really happen except you shouldn&#8217;t get errors.</p>
<p>   Now just create a new page in a web application (Or project if you&#8217;re a loser) and just do this realy quick:</p>
<pre><span style="color: #0000ff;">&lt;%</span><span style="color: #3366ff;">@</span> <span style="color: #800000;">Register</span> <span style="color: #ff0000;">Assembly</span><span style="color: #3366ff;">="Test.Examples"
</span>    <span style="color: #ff0000;">Namespace</span><span style="color: #3366ff;">="Test.Examples.ScriptControlTemplate"</span> <span style="color: #ff0000;">TagPrefix</span><span style="color: #3366ff;">="test"</span> <span style="color: #ffff99;"><span style="color: #0000ff;">%&gt;</span>
</span>
&lt;<span style="color: #800000;">html</span> <span style="color: #ff0000;">xmlns</span><span style="color: #3366ff;">="http://www.w3.org/1999/xhtml"</span> &gt;
&lt;<span style="color: #800000;">head</span> <span style="color: #ff0000;">runat</span><span style="color: #3366ff;">="server"</span>&gt;
&lt;/<span style="color: #800000;">head</span>&gt;
&lt;<span style="color: #800000;">body</span>&gt;
    &lt;<span style="color: #800000;">form</span> <span style="color: #ff0000;">id</span><span style="color: #3366ff;">="form1"</span> <span style="color: #ff0000;">runat</span><span style="color: #3366ff;">="server"</span>&gt;
    &lt;<span style="color: #800000;">div</span>&gt;
        &lt;<span style="color: #800000;">asp:ScriptManager</span> <span style="color: #ff0000;">ID</span><span style="color: #3366ff;">="smMain"</span> <span style="color: #ff0000;">runat</span><span style="color: #3366ff;">="server"</span> /&gt;
        &lt;<span style="color: #800000;">test:ScriptControlExample</span> <span style="color: #ff0000;">ID</span><span style="color: #3366ff;">="sceTest"</span> <span style="color: #ff0000;">runat</span><span style="color: #3366ff;">="server"</span> /&gt;
    &lt;/<span style="color: #800000;">div</span>&gt;
    &lt;/<span style="color: #800000;">form</span>&gt;
&lt;/<span style="color: #800000;">body</span>&gt;
&lt;/<span style="color: #800000;">html</span>&gt;</pre>
<p>    Run it and&#8230;..NOTHING! Surprise! Actually there is something, just nothing visual yet. Next post will get to that. Sucker.</p>
<p>    One thing you can take away from this:  A drinking game.  Take a drink everytime you see the word &#8216;Ok&#8217; in this post.  I dare you.</p>
]]></content:encoded>
			<wfw:commentRss>http://byatool.com/ui/creating-script-controls-and-love/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

