Wednesday, 15 April 2009

AJAX in ASP.NET Overview Part-1

Asynchronous Javascript and XML is a technique that used to execute server side code and return data back to the browser without postbacks or refreshing page.Let's take an example of Google Suggest where return results of query are filled in drop down list while typing the query without refreshing or posting back the page.AJAX pages contains Client side script and Server side code which exchange information through XML and communication between client side and server is carried asynchronously.

Main Object in AJAX is XMLHttpRequest ,with this object,clients can submit and retrieve XML data to /from server without postbacks or reloading page.

var _reqObject= new XMLHttpRequest();

Every latest browser support this object however Internet explorer 6 or old versions doest not.To declare XMLHttpRequest for older browser compatibility,following active- X syntax is used as it would be treated as active-X control.

var _reqObject = new ActiveXObject("MSXML2.XMLHTTP.3.0");

So basically there is lot of workaround for browser checks in code.AJAX components in ASP.NET made it all easier.

ASP.NET AJAX Contains Server side and clients side components. Where Client side components contains Javascript libraries (.js) that can be extended and can also be used in page. It also contains cross browsers compatibility scripts.
Server side contains Controls, UpdatePanel,ScriptManager.

AJAX Library can also be used to call web service(.asmx extensions) .

Before processing to our sample, we need to download


download it from above link for visual studio 2005. This toolkit is for ASP.NET 2.0, for ASP.NET 3.5, ASP.NET AJAX is built-In feature.After Installation of ASPAJAXExtSetup.msi and restarting Visual studio, AJAX extensions is installed in toolbox.
AJAX Extensions contains server side controls, Following controls will be our target to build up a AJAX style Web page.
  1. ScriptManager.
  2. UpdatePanel
  3. Timer

ScriptManager must be placed on page before placing any other AJAX server control o page, as it manages all AJAX Script libraries and files.


No comments:

Post a Comment