System.Web.UI.WebControls.MultiView.ActiveViewIndex Property

Gets or sets the index of the active System.Web.UI.WebControls.View control within a System.Web.UI.WebControls.MultiView control.

Syntax

[System.ComponentModel.DefaultValue(-1)]
public virtual int ActiveViewIndex { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

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

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 to the MultiView.ActiveViewIndex property will be rendered to the client. If the MultiView.ActiveViewIndex property is set to a System.Web.UI.WebControls.View that does not exist within the System.Web.UI.WebControls.MultiView control, a ArgumentOutOfRangeException is raised at run time. If the property is empty, the System.Web.UI.WebControls.MultiView control does not render any content to the client.

You can set the MultiView.ActiveViewIndex property either declaratively at development time or programmatically at run time. Setting the MultiView.ActiveViewIndex property declaratively when you define the System.Web.UI.WebControls.MultiView control causes the System.Web.UI.WebControls.View control that is set as the active view to render to the client the first time the System.Web.UI.WebControls.MultiView control is called. Setting the MultiView.ActiveViewIndex property programmatically 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 or their preferences.

Alternately, you can use the MultiView.SetActiveView(View) and MultiView.GetActiveView methods to set or get the active view within the System.Web.UI.WebControls.MultiView control.

Requirements

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