Skip navigation.

Adding Validators Directly to Page.Validators CollectionAll recent postsProprietary DOM Extensions

Ajax-Enabled Server Controls

Since everything is becoming Ajax-enabled overnight these days, I’m really curious to see how the server control paradigm changes.

Case in point: while extending a third-party control I mentioned previously, I noticed—through the eyes of Reflector—the control was rebuilding itself three times (!) during its life cycle by calling CreateChildControls directly (not via EnsureChildControls, mind you): in OnInit, in DataBind and OnPreRender.

That’s some pretty wild coding, but I trust the vendor had a good reason to develop the control this way. Obviously, it goes through a shortened life cycle upon an out-of-band call, i.e. it pretty much is done rendering after OnInit, which creates some challanges to subclass this control.

Whichever way the changes swing, they’d better have little to no impact on the normal life cycle of server controls. Otherwise we’ll have to learn some pretty nasty hacks. I believe the Atlas team is on the right track:

Rather than performing a real postback, we simulate a postback using the familiar XMLHTTP object (or in Atlas using the Web.Net.WebRequest class). On the server, the page is processed as if it were a real postback in response to things like submit buttons or controls (including 3rd party ones) that call __doPostBack. For example Page.IsPostBack returns true. Server-side postback events continue to fire, and your event handlers continue to do work as they did before.

Way to go!

Comments

Comment permalink 1 Rana |
Hi, I have some quiery reagrding AJAX, if anybody have some idea pelase mail me.

My question is can we use ASP:Server Controls in AJAX.

If yes then how.
Comment permalink 2 Muhammad Ali |
Rana you can use Anthem 1.3.1 if you want to use ASP.Net server controls ... they are same as asp.net server controls ... but they are used as and you dont have to write a single line of javascript to get rid of postbacks...
Comment permalink 3 lokesh lal |
hi
i want to know, how can we make ajax enabled server control using Ajax.Net framework, as i am working on this since last 1 week and not able to figure out how to make a pure drag drop server control using Ajax.net, i use .net 1.1 with sp1.

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

TrackBacks

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):