Tuesday, August 14, 2007

Tips and Tricks with Microsoft AJAX

Wicked Code: UpdatePanel Tips and Tricks -- MSDN Magazine, June 2007

Recently I had my first experience with Microsoft AJAX. In previous incarnations I have written many websites with 'traditional' AJAX using Xml-Http and some client side scripting.

The first thing that struck me about Atlas was that is wasn't lightweight. At all. Sending complete page state and a full page lifecycle. It seemed to me that it was a recipe for writing a really unscalable website without even knowing it. If you don't know what type of load this will place on our bandwidth or server, then I would suggest not doing anything with UpdatePanels and update timers! The use of these controls should be well thought out rather than liberal.

Take for example the task of updating a control when a value is selected in another control. Using Microsoft AJAX this would involve a complete postback of page state and page lifecycle on the server. Now consider when the user is using the keyboard to scroll through the contents of the controlling listbox. That's one postback and page lifecycle for each value that is scrolled over. Eeek! Not my idea of scalable.

In this case it might be better to consider a more traditional AJAX approach. Note that this doesn't mean writing all of the client-side script and the webservice yourself. The Microsoft AJAX toolkit can provide some features to help you. This article presents some options for hooking up a client-side event with a more traditional lightweight approach using the ScriptService and PageMethods.

These are something that are well worth the investigation if you are considering using Microsoft AJAX toolkit extensively on your site. A little bit of fore-thought can go a long way.

kick it on DotNetKicks.com Shout it

1 comment:

Blogger said...

Searching for the Best Dating Website? Join to find your perfect date.