Archive for January, 2010

AJAX multiple Update Panel, Triggers in ASP.NET

AJAX (Asynchronous JavaScript and XML) is not a web development tool; it’s rather a web development approach on client side to create interactive web application. Some basic AJAX Extensions to start developing AJAX enabled web page in ASP.NET are as follows.


To enable AJAX in a page, you will require at least and only one ScriptManger in your ASP.NET page. Just drag ScriptManager from Ajax Extensions of Toolbox and drop it preferably at the beginning of your page. It will generate following code snippet in your web page and that’s all to do with ScriptManager.


User controls in web page that you want to behave interactively must be in between some Update Panel Tags. You may have some multiple update panels in a page.

However, UpdatePanel does not directly contain the user controls; it is rather “ContentTemplate” tag that contains the user controls in UpdatePanel.

Another important property of UpdatePanel is “UpdateMode” that can be assigned either “Conditional” or ”Always” value. It takes “Always” as default value if not specified and updates each time whenever any portion/UpdatePanel of page is posted back whereas “Conditional” value allows updating only when the specific UpdatePanel is posted back.

Triggers” is an important Tag like “ContentTemplate” in UpdatePanel. This says when to post back the UpdatePanel.

Download Source Code. In this demo, I have used three UpdatePanels in AjaxTrial.aspx page. One is for clock that is continuously posted back the UpdatePanel in every second, second one has a ListBox and a Label and is posted back at selectedItemChange event of the ListBox. The third UpdatePanel has a Button and a Label in it and this one is posted back at Button Click event.

A Rahim khan