This is the sixth in a series of blog posts
about Microsoft ASP.NET AJAX, a new web development technology from Microsoft.
Click these links to view previous posts in
this series:
Post 1,
Post 2, Post
3,
Post 4 and
Post 5
This
article introduces the Microsoft Ajax PageRequestManager object and
demonstrates how to handle its pageLoaded event to it trigger an animation
when a page is updated after an asynchronous post back.
PageRequestManager Overview
The PageRequestManager class in the
Microsoft AJAX Library manages partial-page rendering on the client.
When you have a ScriptManager and one or
more UpdatePanel controls on the page, the page is automatically enabled for
partial-page rendering.
The PageRequestManager exposes properties,
methods, and events that allow you to customize the partial-page rendering
experience with client script.
- Provide custom error message handling
for partial-page rendering.
- Control multiple asynchronous
postbacks.
- Display status messages during
asynchronous postbacks.
- Access the underlying request and
response objects used in an asynchronous postback.
Partial-Page
Rendering Event Handling
During page processing (both postbacks and
asynchronous postbacks), you can handle DOM events to run custom script.
However, these DOM events do not enable you
to access information or control the behavior during asynchronous postbacks
and during partial-page updates that occur between the load and unload of
the page in the browser.
The PageRequestManager class exposes the
following events that enable you to customize partial-page rendering:
- initializeRequest
- beginRequest
- pageLoading
- pageLoaded
- endRequest
About the Source Code
The source code implements an ASP.NET 2.0
web application that shows how you can use the pageLoaded event of the
PageRequestManager class to animate an UpdatePanel control when the page is
updated after an asynchronous postback.

In this web page shown above, users can select
a date and enter an email address into a simple form to make a ticket request.
When certain elements postback from the page ( (1) above), the panel is animated
briefly to notify the user that the date value was entered into the text box.
The page contains a popup that displays a Calendar control. The calendar is
displayed or hidden using the control's Visible property. Hiding, showing, or
selecting dates in the calendar does not cause the entire page to be refreshed,
because the Calendar control is inside an UpdatePanel control.
The source code included with this post (see
download link above) includes additional comments about the example.
The source code was created with ASP.NET AJAX
1.0 Beta 2. For more information and FREE Microsoft ASP.NET Ajax
installers visit -> The Official Microsoft
ASP.NET AJAX Website
mike mcintyre
http://www.getdotnetcode.com |