System.Web.UI.WebControls.MultiView.SetActiveView Method

Sets the specified System.Web.UI.WebControls.View control to the active view within a System.Web.UI.WebControls.MultiView control.

Syntax

public void SetActiveView (View view)

Parameters

view
A System.Web.UI.WebControls.View control to set as the active view within a System.Web.UI.WebControls.MultiView control.

Remarks

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

Using the MultiView.SetActiveView(View) method to programmatically set the active view 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 and preferences.

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

Requirements

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