System.Web.UI.WebControls.MultiView Class

Represents a control that acts as a container for a group of System.Web.UI.WebControls.View controls.

See Also: MultiView Members

Syntax

[System.ComponentModel.DefaultEvent("ActiveViewChanged")]
[System.Web.UI.ParseChildren(typeof(System.Web.UI.WebControls.View))]
[System.Web.UI.ToolboxData("<{0}:MultiView runat="server"></{0}:MultiView>")]
[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.MultiViewDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
public class MultiView : System.Web.UI.Control

Remarks

In this topic:

Introduction

The System.Web.UI.WebControls.MultiView control is a container for a group of System.Web.UI.WebControls.View controls. It allows you to define a group of System.Web.UI.WebControls.View controls, where each System.Web.UI.WebControls.View control contains child controls. Your application can then render a specific System.Web.UI.WebControls.View control to the client based on criteria such as user identity, user preferences, and information passed in a query-string parameter. You can also use the System.Web.UI.WebControls.MultiView control to create wizards. In this scenario, each System.Web.UI.WebControls.View control contained in a System.Web.UI.WebControls.MultiView control represents a different step or page in the wizard. You should also use this control to develop multiple-screen applications for mobile devices. This control provides the same functionality as the ASP.NET mobile System.Web.UI.MobileControls.Form control in .NET Framework version 1.1.

Only one System.Web.UI.WebControls.View control at a time can be defined as the active view within a System.Web.UI.WebControls.MultiView control. When a System.Web.UI.WebControls.View control is defined as the active view, the child controls that it contains are rendered to the client. You can use either the MultiView.ActiveViewIndex property or the MultiView.SetActiveView(View) method to define the active view. If the MultiView.ActiveViewIndex property is empty, the System.Web.UI.WebControls.MultiView control does not render any content to the client. If the active view is set to a System.Web.UI.WebControls.View that does not exist within the System.Web.UI.WebControls.MultiView control, an ArgumentOutOfRangeException is raised at run time.

You can define the active view declaratively or programmatically. Setting the MultiView.ActiveViewIndex property declaratively when you define the System.Web.UI.WebControls.MultiView control causes the System.Web.UI.WebControls.View control that is set as the active view to render to the client the first time the System.Web.UI.WebControls.MultiView control is called. The following code example demonstrates how to set the MultiView.ActiveViewIndex property declaratively.

Example

<asp:MultiView id="MultiView1" ActiveViewIndex=0 runat="Server"> 

Setting the MultiView.ActiveViewIndex property programmatically, or calling the MultiView.SetActiveView(View) method, allows the application to determine which System.Web.UI.WebControls.View control to render to the client at run time based on criteria such as a user's identity or preferences.

To allow users to navigate between System.Web.UI.WebControls.View controls within a System.Web.UI.WebControls.MultiView control, you can add a System.Web.UI.WebControls.LinkButton or System.Web.UI.WebControls.Button control to each System.Web.UI.WebControls.View control. To take advantage of the System.Web.UI.WebControls.MultiView control's automatic updating of the currently active System.Web.UI.WebControls.View, set the CommandName property on the button or link button to the value of one of the following command-name fields that corresponds to the desired navigation behavior: MultiView.PreviousViewCommandName, MultiView.NextViewCommandName, MultiView.SwitchViewByIDCommandName, or MultiView.SwitchViewByIndexCommandName.

Declarative Syntax

Example

<asp:MultiView
    ActiveViewIndex="integer"
    EnableTheming="

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0