Using the UpdatePanel Control

In this section, we'll walk through three increasingly complex examples of UpdatePanel. Each example begins from an ASP.NET 2.0 page that runs without ASP.NET Ajax. By adding UpdatePanel controls in strategic places, you can considerably improve the user's experience with minimal changes.

The first example is a wizard, the second is a master/details scenario that you might find on an e-commerce site, and the third is a simple search engine that could be part of the same site.

Making the ASP.NET 2.0 Wizard Control Behave in a More Fluid Manner

ASP.NET 2.0 introduced the Wizard control, a feature that enables developers to break tasks too complex for a single page into a number of smaller steps. Before moving from one step to the next, however, the control must post back to the server, which forces the user to wait while the browser completes its work. Example 2 shows markup and C# code for a very simple, three-step wizard page. In the first step, you enter your name; in the second step, you enter your address; and in the third step, a summary of the data you entered in the first two steps is displayed.

Example 2. A simple page with a Wizard control

<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>A simple wizard</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Wizard runat="server" ID="Wizard1" ...

Get ASP.NET AJAX UpdatePanel Control now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.