Friday, 10 August 2007

ASP.NET AJAX ScriptManager in Web Applications

Today the buzz word is "AJAX". It's a great technique used to create interactive web applications. It makes the web applications responsiveness similar to client-side standalone applications. ASP.NET AJAX was released by Microsoft to easily integrate into web applications. The central component, ScriptManager control is the core of ASP.NET AJAX. Its primary role is the arbitration of all other ASP.NET AJAX controls on the Web Form and the addition of the right scripting libraries to the Web browser so that the client portion of ASP.NET AJAX can function.

Scripting with ScriptManager

ScriptManager reacts to events in the ASP.NET page lifecycle and uses those events to coordinate the activities of all the controls, options, and code employed by ASP.NET AJAX. ScriptManager will hook a particular event, get notified when it occurs, and configure a few settings depending on the environment; this process will repeat itself several times through the rendering cycle of your ASP.NET page.

The steps necessary to create a class based on the ASP.NET AJAX script extensions are:

  • Register the namespace with ASP.NET AJAX
  • Create a constructor method
  • Create a class prototype by filling in the member methods and their functionality
  • Register the class with ASP.NET AJAX
  • Notify the client script added by the ScriptManager that you have reached the end of the type definition (the call to Sys.Application.notifyScriptLoaded).

WorkFlow of ScriptManager


The workflow of the scriptmanager is shown in the figure. It gives an idea of how the scriptmanager registers and responds to events. You can find out more information about ScriptManager.