This documentation is archived and is not being maintained.

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.

ExceptionCondition
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.

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 Page Code Model.

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: