MultiView::GetActiveView Method ()
Assembly: System.Web (in System.Web.dll)
| Exception | Condition |
|---|---|
| Exception | The ActiveViewIndex property is not set to a valid View control within the MultiView control. |
Use this method to return the View control within a MultiView control that is currently set as the active view. This method returns a View control and therefore can be used to access the properties of the active view. For example, MultiView1.GetActiveView.ID returns the value of the ID property of the current active view in MultiView1.
Alternately, you can use the ActiveViewIndex property to get or set the zero-based index of the current active view in a MultiView control. This property can be accessed either declaratively or programmatically.
The following example demonstrates how to create a MultiView control that contains three View controls. When the ActiveViewChanged event is raised, the GetActiveView method is used to return the current active view and display it in a Label control on the page.
Note |
|---|
The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Forms Page Code Model. |
Available since 2.0
