A lot of features are packed into the ASP.NET AJAX framework. As a result, many common tasks can be accomplished using existing controls that handle making asynchronous calls to ASP.NET pages or web services. Many of the complexities associated with making asynchronous calls are hidden so that you can focus on building the application rather than on the message processing that happens behind the scenes. A perfect example of this is the UpdatePanel control, which makes it easy to add AJAX functionality into an ASP.NET page without writing a lot of code. Simply add an UpdatePanel to an ASP.NET page and you have instant AJAX functionality available even if you’ve never made an asynchronous call before in your life.
In this chapter, you’ll learn how to build custom ASP.NET AJAX controls capable of generating dynamic output, handling end user interactions, and connecting to web services. Topics covered include the overall structure of client-side controls as well as how constructors, properties, functions, events, and event handlers can be defined and used. You’ll also see how client-side scripts can be encapsulated in server controls and exposed using familiar ASP.NET server control syntax. Once this is done, you can simply drop a server control on a form and set some properties to inject client script into the response stream at runtime. Let’s get started by analyzing the structure of custom client-side controls and discussing key classes provided by the ASP.NET AJAX script library.