O'Reilly logo

Professional ASP.NET 3.5 AJAX by Matt Gibbs, Dan Wahlin, Bill Evjen, Dave Reed

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.5. The Client-Side Page Request Lifecycle

ASP.NET developers have been working with the ASP.NET page lifecycle since the first days of ASP.NET 1.0. An ASP.NET developer knows that they are able to interact with the page and its rendering at one of many specific moments in the page request or response lifecycles. For instance, working with page as it is being loaded is as simple as using the Page_Load() event within your page's code-behind.

protected void Page_Load(object sender, EventArgs e)
{
   // Perform desired actions here
}

As with the series of server-side interactions with the page lifecycle, you are also able to interact with the page lifecycle on the client side through a series of page lifecycle events. This is an important feature, and even using DOM today within the browser, you are able to currently work with the page's invocation of the window.onload() and window.onunload() events using JavaScript. However, you are able to work with these two events only when the ASP.NET page does a complete and full page postback. This means that the asynchronous postbacks, or partial-page postbacks, that ASP.NET AJAX performs would be unable to work with such events.

Interacting with the client-side page events is a matter of using the PageRequestManager class provided with ASP.NET AJAX. The PageRequestManager class is the glue between the ScriptManager control on the page and the control that needs to make use of the partial-page updating. The lifecycle provided by the PageRequestManager ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required