Making a Page Region Updateable

A list of Ajax advantages would most certainly contain something along the lines of: “Changing a section of a web page without performing a postback.” In previous chapters, this was often done by retrieving data from the server and then using JavaScript and DOM to use this data and populate an element on the page.

One very neat feature of Atlas is the ability to perform partial page updates. That means that one section of a page is updated, like with a page reload, but without a complete page postback.refresh. Also, no JavaScript is required (from the developer); Atlas takes care of that.

The Atlas control that makes this possible is UpdatePanelcontrol. Everything inside an update panel works like a page within a page. The contents of the panel are refreshed from the server (using XMLHttpRequest, of course). However, from the programming model, it looks like a regular page refresh. If you 233re accessing Page.IsPostBack, this has the value true when an updateable portion of a page is refreshed from the server. All other events that are raised during ordinary postbacks are also raised for update panel refreshes.

Tip

You can think of an UpdatePanel as an iframe (internal frame in a web site, using the <iframe> HTML element) within a page. This section is reloaded and refreshed on its own. However the main advantage in comparison to using a regular iframe is that the ASP.NET page life cycle events are still raised, so programmatically, you only have one ...

Get Programming Atlas now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.