Tuesday 1 May 2012

Ajax Class in ASP.Net Client

Two main Microsoft Ajax Library classes that raise events during the client life cycle of a WebForms based page are the Application and PageRequestManager classes.

Events (like page_load, page_Init etc....) that are raised by the Application and PageRequestManager classes.

The Microsoft Ajax Library also contains classes for adding, clearing, and removing handlers for DOM element events
           Application is handel the page and controls events (like page_load, page_Init etc....)  
           PageRequestManager  is handel server postback and  asynchronous postbacks object ( like Request, Respose etc... )

Add or Remove handlers for events raised by the Application and PageRequestManager classes,
 Example
                       function MyTest() // Declare the handler
                              { alert('Harshad Patel');
                              }
                             Sys.Application.add_init(MyTest) // add 'MyTest' to Page_Init Event
                             Sys.Application.remove_init(MyTest) // remove 'MyTest' to Page_Init Event
An instance of the PageRequestManager class is automatically available in the browser (Client Side)
like
               var PM = Sys.WebForms.PageRequestManager.getInstance();





    No comments:

    Post a Comment