Pages

Sunday 15 April 2012

What is ASP.NET AJAX?

The ASP.NET AJAX Toolkit was not part of the default .NET Framework 2.0 install. If you are using the .NET Framework 2.0, then it is an extra component that you must download from the Internet. If you are using ASP.NET 3.5 or 4, then you don't have to worry about installing the ASP.NET AJAX Toolkit because everything you need is already in place for you. This toolkit has following components:

1. ScriptManager: A component control that manages the marshalling of messages to the AJAX-enabled server for the parts of the page requiring partial updates. EveryASP.NET page will require a ScriptManager control in order to work. Note that you can have only a single ScriptManager control on a page.

2. ScriptManagerProxy: A component control that acts as a ScriptManager control for a content page. The ScriptManagerProxy control, which sits on the content page (or sub-page), works in conjunction with a required ScriptManager control that resides on the master page.

3. UpdatePanel: A container control that allows you to define specific areas of the page that are enabled to work with the ScriptManager. These areas can then, in turn, make the partial page Postbacks and update themselves outside the normal ASP.NET page Postback process.

Note: If there are  more than 2 updatePanels then it may happen that when one updatePanel is fired, second one also get fired. You can actually control this behavior through the UpdatePanel's updateMode property. The updateMode property can take two possible enumerations — Always and Conditional. If you do not set this property, then it uses the value of Always, meaning that each UpdatePanel control always updates with each asynchronous request.

The other option is to set the property to Conditional. This means that the UpdatePanel updates only if one of the trigger conditions is met.

<ContentTemplate> and <Triggers>

<ContentTemplate> Any content that needs to be changed with the asynchronous page Postbacks should be contained within the <ContentTemplate> section of the UpdatePanel control.

<Triggers> Contains the control which trigger the postback like buttons.  

4. UpdateProgress: A control that allows you to display a visual element to the end user to show that a partial-page Postback is occurring to the part of the page making the update. This control is ideal to use when you have long-running AJAX updates.

5. Timer: One common task when working with asynchronous Postbacks from your ASP.NET pages is that you might want these asynchronous Postbacks to occur at specific intervals in time. To accomplish this, you use the Timer control available from the AJAX Extensions part of the toolbox. Default intervel is 60,000 ms (1 min) and it works under Tick event.

No comments:

Post a Comment