System.Web 2.0.0.0 System.Web.UI.Control 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")

In this topic:

Introduction

Declarative Syntax

## Introduction

The control is a container for a group of controls. It allows you to define a group of controls, where each control contains child controls. Your application can then render a specific 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 control to create wizards. In this scenario, each control contained in a 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 control in .NET Framework version 1.1.

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

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

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

Setting the property programmatically, or calling the method, allows the application to determine which 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 controls within a control, you can add a or control to each control. To take advantage of the control's automatic updating of the currently active , 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: , , , or .

## Declarative Syntax

`<asp:MultiView ActiveViewIndex="integer" EnableTheming="True|False" EnableViewState="True|False" ID="string" OnActiveViewChanged="ActiveViewChanged event handler" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Visible="True|False" > <asp:TemplatedWizardStep AllowReturn="True|False" ContentTemplateContainer="string" EnableTheming="True|False" EnableViewState="True|False" ID="string" OnActivate="Activate event handler" OnDataBinding="DataBinding event handler" OnDeactivate="Deactivate event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" StepType="Auto|Complete|Finish|Start|Step" Title="string" Visible="True|False" > <ContentTemplate> <!-- child controls --> </ContentTemplate> <CustomNavigationTemplate> <!-- child controls --> </CustomNavigationTemplate> </asp:TemplatedWizardStep> <asp:View EnableTheming="True|False" EnableViewState="True|False" ID="string" OnActivate="Activate event handler" OnDataBinding="DataBinding event handler" OnDeactivate="Deactivate event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Visible="True|False" /> <asp:WizardStep AllowReturn="True|False" EnableTheming="True|False" EnableViewState="True|False" ID="string" OnActivate="Activate event handler" OnDataBinding="DataBinding event handler" OnDeactivate="Deactivate event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" StepType="Auto|Complete|Finish|Start|Step" Title="string" Visible="True|False" /> </asp:MultiView>`

Represents a control that acts as a container for a group of controls.

- Constructor

  Use this constructor to create and initialize a new instance of the class.

  Initializes a new instance of the class.

  2.0.0.0
- Event
  System.EventHandler

  The event is raised when the active control within a control changes between posts to the server.

  For more information about handling events, see How to: Consume Events in a Web Forms Application.

  Occurs when the active control of a control changes between posts to the server.

  2.0.0.0
- Property
  System.ComponentModel.DefaultValue(-1)
  System.Int32 To be added.

  Use the property to set a control within a control as the active view. You can also use this property to return the index of the control that is currently set as the active view. The index of a control is determined by the order in which it is declared within a control. For example, the first control declared within a control has an index of 0.

  Only one control at a time can be defined as active within a control. The control that is set to the property will be rendered to the client. If the property is set to a that does not exist within the control, a is raised at run time. If the property is empty, the control does not render any content to the client.

  You can set the property either declaratively at development time or programmatically at run time. Setting the property declaratively when you define the control causes the control that is set as the active view to render to the client the first time the control is called. Setting the property programmatically allows the application to determine which control to render to the client at run time based on criteria such as a user's identity or their preferences.

  Alternately, you can use the and methods to set or get the active view within the control.

  Gets or sets the index of the active control within a control.

  2.0.0.0
- Method
  System.Void `` To be added.

  This method overrides the base class implementation to allow only controls to be added to the .

  Notifies the control that an XML or HTML element was parsed, and adds the element to the collection of the control.

  2.0.0.0
- Method
  System.Web.UI.ControlCollection

  This method overrides the base implementation to always return a to contain the controls of the current control.

  Creates a to hold the child controls of the control.

  A to contain the controls of the current control.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(true)
  System.Boolean To be added.

  The property indicates whether themes are enabled for the control. The property also affects whether themes are enabled for the controls contained in its collection. When the property is true, the application's theme directory is searched for control skins to apply. If no skin for the particular control exists in the theme directory, a skin is not applied. When the property is false, the theme directory is not searched and the contents of the property are not used.

  A control can override the value set by its parent control or the containing page. For example, if a control has set to false, you can selectively apply themes to individual controls contained within the control by setting the property to true on the individual child controls.

  Gets or sets a value indicating whether themes apply to the control.

  2.0.0.0
- Method
  System.Web.UI.WebControls.View

  Use this method to return the control within a control that is currently set as the active view. This method returns a control and therefore can be used to access the properties of the active view. For example, MultiView1.GetActiveView.ID returns the value of the property of the current active view in MultiView1.

  Alternately, you can use the property to get or set the zero-based index of the current active view in a control. This property can be accessed either declaratively or programmatically.

  Returns the current active control within a control.

  A control that represents the active view within a control.

  2.0.0.0
- Method
  2.0.0.0
  System.Void `` To be added.

  Loads the current state of the control.

  An that represents the state of the control.
- Field
  System.String

  Use the field to represent the "NextView" command name.

  You can use the value of this field to take advantage of the control's automatic updating of the active control. For example, if a control contains a control that navigates to the previous , you can set the property to the value of the field, which is "NextView". This causes the control to automatically decrement the value of the property when the button is clicked.

  Represents the command name associated with the next control to display in a control. This field is read-only.

  2.0.0.0
- Method
  System.Void ``

  The event is raised when the active control within a control changes between posts to the server, and you can provide a custom handler for this event.

  Raising an event invokes the event handler through a delegate. For more information, see How to: Consume Events in a Web Forms Application.

  The method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.

  Raises the event of a control.

  A that contains the event data. 2.0.0.0
- Method
  System.Boolean `` ``

  A control contains controls that raise events. This method overrides the base implementation to handle navigation between controls.

  Determines whether the event for the control is passed to the page's UI server control hierarchy.

  true if the event has been canceled; otherwise, false. The default is false.

  The source of the event. An object that contains the event data. 2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  When notified by this method, a control must perform any initialization steps that are required to create and set up an instance. In this stage of the server control's lifecycle, the control's view state has yet to be populated. You cannot access another server control when this method is called, even if it is a child or parent of this control. Other server controls are not certain to be created and ready for access.

  Raises the event.

  An object that contains the event data.
- Field
  System.String

  Use the field to represent the "PrevView" command name.

  You can use the value of this field to take advantage of the control's automatic updating of the active control. For example, if a control contains a control that navigates to the next , you can set the property to the value of the field, which is "PrevView". This causes the control to automatically increment the value of the property when the button is clicked.

  Represents the command name associated with the previous control to display in a control. This field is read-only.

  2.0.0.0
- Method
  2.0.0.0
  System.Void ``

  The method is called immediately after a control is removed from the collection of a control.

  Called after a control is removed from the collection of a control.

  The control that has been removed.
- Method
  2.0.0.0
  System.Void ``

  The method is used primarily by control developers when deriving a custom class from the control.

  The method writes the rendered content of the active view to the client using the supplied . You can set the active view in a control using the method or the property. You can determine which one of the controls in the collection is the active view, if any, by using the method or the property.

  If an active view is set for the control, the active control is used to render content for that view and its child controls. If an active view is not set for the control, no content is rendered to the .

  Writes the control content to the specified object, for display on the client.

  An that represents the output stream to render HTML content on the client.
- Method
  2.0.0.0
  System.Object To be added.

  Saves the current state of the control.

  An that represents the state of the control. If there is no state associated with the control, this method returns null.

- Method
  System.Void ``

  Use this method to set a control within a control as the active view. Only one control at a time can be defined as active within a control. The control that is set as the active view is rendered to the client. If a control that does not exist within the control is set as active, an exception is raised at run time. If no control is set as the active view, the control does not render any content to the client.

  Using the method to programmatically set the active view allows the application to determine which control to render to the client at run time based on criteria such as a user's identity and preferences.

  Alternately, you can use the property to get or set the zero-based index of the current active view in a control. This property can be accessed either declaratively or programmatically.

  Sets the specified control to the active view within a control.

  A control to set as the active view within a control. 2.0.0.0
- Field
  System.String

  Use the field to represent the "SwitchViewByID" command name.

  You can use the value of this field to take advantage of the control's automatic updating of the active control. For example, if a control contains a control that navigates to the first when clicked, you can set the property to the value of the field, which is "SwitchViewByID". Set the property to the ID of the first in the control, such as "Page1". This causes the control to automatically set "Page1" as the active when the button is clicked.

  Represents the command name associated with changing the active control in a control, based on a specified id. This field is read-only.

  2.0.0.0
- Field
  System.String

  Use the field to represent the "SwitchViewByIndex" command name.

  You can use the value of this field to take advantage of the control's automatic updating of the active control. For example, if a control contains a control that navigates to the first when clicked, you can set the property to the value of the field, which is "SwitchViewByIndex". Set the property to the index of the first in the control, which is 0. This causes the control to automatically set the property to 0 when the button is clicked.

  Represents the command name associated with changing the active control in a control based on a specified index. This field is read-only.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty)
  System.Web.UI.WebControls.ViewCollection To be added.

  Use this property to programmatically manage the controls in a control.

  Gets the collection of controls in the control.

  2.0.0.0