Thursday, April 15, 2010

Ajax and SharePoint web part loading

One of the marvels of modern web technology is the ability to communicate with the web server asynchronously using partial postbacks. This ensures that the web application behaves more like a desktop application and there are no full page refreshes required to reload the information that is hosted on a web page. Since 2005 Ajax has been used as a mainstream web development technique and has support from most software vendors including Microsoft.

Having the ability to reload only the areas of a web page that are required, improves the user experience and eliminates the page flickers that plagued early web applications. The benefits of using Ajax are really only seen on the client side, with very little to no changes in the web server infrastructure. The web request method still relies on a single call to request the web page content and does not support simultaneous requests.

If your web part relies on server requests to provide data to the UI, you may consider queueing the requests to ensure that the web parts each get a turn to request their information. The benefit of this approach is that the web parts will render their content and issue a postback once the entire page has been rendered.

The following script will enqueue post back requests and issue them in sequence for each web part.

No comments:

Post a Comment