MultiView and View Controls

Sometimes you might want to break a web page into different chunks, displaying only a single chunk at a time, with easy navigation from chunk to chunk. The classic use of this technique would be to step a user through a number of process steps within the context of a static page, such as the checkout procedure from an online store or the procedure to transfer funds from one account to another. You might also use these controls to create wizard-like applications, although there is now a Wizard control, described shortly, for this exact purpose.

ASP.NET provides the View control to manage the chunks—i.e., the content in a section of the page: one View control per chunk. All of the View objects are contained together within a MultiView object, which makes one View object, called the active view, visible at a time.

As seen in Figure 3-4b both the View and Multiview controls derive not from WesControl, but directly from System.Wes.UI.Control.

The MultiView control has a read-only property called Views, of type ViewCollection, which is a collection of the View controls contained within the MultiView. As with all .NET collections, the elements in the collection are indexed. Hence, the MultiView control has a property called ActiveViewIndex, which gets or sets the zero-based index of the currently active view. If no view is active, then ActiveViewIndex will be 1, which is the default value.

The MultiView control has four properties, listed in Table 5-1, that correspond ...

Get Programming ASP.NET, 3rd Edition 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.