MultiView::GetActiveView Method ()

 

Returns the current active View control within a MultiView control.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
View^ GetActiveView()

Return Value

Type: System.Web.UI.WebControls::View^

A View control that represents the active view within a MultiView control.

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.

System_CAPS_noteNote

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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: