Server Controls with Client Capabilities (Ajax)
It can be extremely difficult to manipulate the client aspects of your web server controls using server code alone. In fact it's impossible to do some things with server code alone. In these cases, ASP.NET developers turn to JavaScript for help.
But, sometimes it's not enough for your control to just call a JavaScript function that does something. In some cases, your control needs to know what was done while it existed in the web browser. In order to do this, your control needs to be represented as a JavaScript Object as well as a .NET Object.
So, you need create two components to your control: the .NET server code that contains the class information for your server control, and the JavaScript client code that also contains class information about your control. The nice thing is that .NET provides a template that you can use to create the JavaScript Object: the AJAX Client Control. When you add an Ajax Client Control to your project, it creates a skeleton JavaScript class that uses the ASP.NET Ajax Libraries. (If you are unfamiliar with JavaScript Objects you should probably familiarize yourself with them now because things are going to be confusing for you if you don't understand these) Please note that the ASP.NET Ajax Libraries are added to the page by the ScriptManager control. This means that your control will require a ScriptManager to exist on the page in order for it to work.
Now you know that you need two classes (one for each environment); but, how do get these two classes work together? You need a way for your server and client code to be able to transfer information too each other. This is made possible by implementing the IScriptControl Interface.
Ok, enough background information on what these controls are and why they are needed.
Let's further explain them using an example so that you can see how cool they are!
Example
Say you want to expand on a regular ASP.NET Panel.
............... ...
Help
More Help
ASP.NET Ajax Library Documentation
DOM
It can be extremely difficult to manipulate the client aspects of your web server controls using server code alone. In fact it's impossible to do some things with server code alone. In these cases, ASP.NET developers turn to JavaScript for help.
But, sometimes it's not enough for your control to just call a JavaScript function that does something. In some cases, your control needs to know what was done while it existed in the web browser. In order to do this, your control needs to be represented as a JavaScript Object as well as a .NET Object.
So, you need create two components to your control: the .NET server code that contains the class information for your server control, and the JavaScript client code that also contains class information about your control. The nice thing is that .NET provides a template that you can use to create the JavaScript Object: the AJAX Client Control. When you add an Ajax Client Control to your project, it creates a skeleton JavaScript class that uses the ASP.NET Ajax Libraries. (If you are unfamiliar with JavaScript Objects you should probably familiarize yourself with them now because things are going to be confusing for you if you don't understand these) Please note that the ASP.NET Ajax Libraries are added to the page by the ScriptManager control. This means that your control will require a ScriptManager to exist on the page in order for it to work.
Now you know that you need two classes (one for each environment); but, how do get these two classes work together? You need a way for your server and client code to be able to transfer information too each other. This is made possible by implementing the IScriptControl Interface.
Ok, enough background information on what these controls are and why they are needed.
Let's further explain them using an example so that you can see how cool they are!
Example
Say you want to expand on a regular ASP.NET Panel.
............... ...
Help
More Help
ASP.NET Ajax Library Documentation
DOM
Comment