Tuesday, November 27, 2007

ASP.NET AJAX Overview

I was doing R & D on how efficiently we can load data in grid view and i figured out one Asynchronous method to load data,...using Ajax here is a note on that..

What is Ajax ?


•AJAX (Asynchronous JavaScript and XML), or Ajax, is a web development technique used for creating interactive web applications


• exchange small amounts of data with the server behind the scenes so that the entire web page does not have to be reloaded each time the user requests a change


Before going though Asp.net Ajax let me tell you some defnition of Server controls

The following list describes the most frequently used ASP.NET AJAX server controls



ScriptManager


•Manages script resources for client components, partial-page rendering, localization,
globalization, and custom user scripts. The ScriptManager control is required in order to use the UpdatePanel, UpdateProgress, and Timer controls.


UpdatePanel


Enables you to refresh selected parts of the page, instead of refreshing the whole page by using a synchronous postback.



UpdateProgress


•Provides status information about partial-page updates in UpdatePanel controls.


Timer


•Performs postbacks at defined intervals. You can use the Timer control to post the whole page, or use it together with the UpdatePanel control to perform partial-page updates at a defined interval.

Code Sample
-- This code is need to execute script

-- This is the panel, all the controls inside this panel will get updated asynchronously











-->



-- This will say what to trigger




--- This will perform when the updation is in progress



---------------

---- This is the link button where u say apply filter


---- This code will fire asynchronously

protected void lbFilter_Click(object sender, EventArgs e)
{
FillGridView( txtName.Text );
}


private void FillGridView( string filter )
{
gridViewPersons.DataSource = get dataset ;
gridViewPersons.DataBind();
}



For more details see this
http://msdn2.microsoft.com/en-us/library/bb398874(VS.90).aspx

This code will load the grid with out refreshing page ,..

But, still i am not sure how this will improve performence,..
Will it take more time to load data,..
What happens if i click on other button when this process is executing,..
Need to figure out ..........