Export (0) Print
Expand All

Partial-page rendering overview

Partial-page rendering removes the need for the whole page to be refreshed as the result of a postback. Instead, only individual regions of the page that have changed are updated. As a result, users do not see the whole page reload with every postback, which makes user interaction with the web page more seamless. ASP.NET enables you to add partial-page rendering to new or existing ASP.NET web pages without writing client script.

You can extend existing ASP.NET applications and develop new ones that incorporate AJAX (Asynchronous JavaScript and XML) functionality. AJAX features in ASP.NET enable you to build rich web applications that have many advantages over web applications that are completely server-based. Use AJAX features when you want to do the following:

  • Improve the user experience with web pages that are richer, that are more responsive to user actions, and that behave like traditional client applications.

  • Reduce full-page refreshes and avoid page flicker.

  • Enable cross-browser compatibility without writing client scripts.

  • Perform AJAX-style client/server communication without writing client scripts.

  • Use controls and components from the ASP.NET AJAX Control Toolkit.

  • Develop custom ASP.NET AJAX controls.

Partial-page rendering relies on server controls in ASP.NET and on client functions in the Microsoft AJAX Library. You do not have to use the Microsoft AJAX Library to enable partial-page rendering, because this functionality is provided automatically when you use the ASP.NET AJAX server controls. However, you can use the APIs exposed in the client library for additional AJAX functionality.

The primary features of ASP.NET that support partial-page rendering are:

  • A declarative model that works like ASP.NET server controls. In many scenarios, you can specify partial-page rendering using only declarative markup.

  • Server controls that perform the underlying tasks required for partial-page updates. These include the ScriptManager control and the UpdatePanel control.

  • Integration between ASP.NET AJAX server controls and the Microsoft AJAX Library for common tasks. These tasks include enabling users to cancel a postback, displaying custom progress messages during an asynchronous postback, and determining how concurrent asynchronous postbacks are processed.

  • Error-handling options for partial-page rendering, which enable you to customize how errors are displayed in the browser.

  • Cross-browser compatibility, which is built into the AJAX functionality of ASP.NET. Simply using the server controls automatically invokes the correct browser functionality.

Typical web pages built with ASP.NET web server controls perform postbacks initiated by a user action on the page, such as clicking a button. In the response, the server renders a new page. Frequently this re-renders controls and text that did not change between postbacks.

With partial-page rendering, you can refresh individual regions of the page asynchronously and make the page more responsive to the user. You can implement partial-page rendering using ASP.NET AJAX web server controls, and optionally write client script that uses the APIs in the Microsoft AJAX Library.

Server controls for partial-page updates

To add AJAX functionality to ASP.NET web pages, you identify individual sections of the page that you want to update. You then put the content of these sections into UpdatePanel controls. The contents of an UpdatePanel control can be HTML or other ASP.NET controls. You can add an UpdatePanel control to the page as you would add any other control. For example, in Microsoft Expression Web you can drag it from the Toolbox panel to the web page, or you can add it by adding the code for the control in the Code view of the page.

By default, postbacks that originate from controls inside the update panel (child controls) automatically initiate asynchronous postbacks and cause a partial-page update. You can also specify that controls outside the update panel cause an asynchronous postback and that they refresh the UpdatePanel control's content. A control that causes an asynchronous postback is referred to as a trigger.

An asynchronous postback behaves much like a synchronous postback. All the server page life-cycle events occur, and view state and form data are preserved. However, in the rendering phase, only the contents of the UpdatePanel control are sent to the browser. The rest of the page remains unchanged.

To support partial-page rendering, you must put a ScriptManager control on the page. The ScriptManager control keeps track of all the update panels on the page and of their triggers. It coordinates partial-page rendering behavior on the server, and determines which sections of the page to render as a result of an asynchronous postback.

For more information about partial-page rendering, see Partial-Page Rendering Overview in the MSDN Library.

Community Additions

ADD
Show:
© 2014 Microsoft