System.Web.UI.WebControls Namespace MultiView Class
Sets the specified View control as the active view within a MultiView control.
[ VB ]
Public Sub SetActiveView ( _
view As View _
)
[ C# ]
public void SetActiveView (
View view
)
[ C++ ]
void SetActiveView (
View^ view
)
[ JScript ]
public void SetActiveView (
View view
)
- view
- A View control to set as the active view within a MultiView control.
Exception Type |
Condition |
HttpException |
The specified view parameter value is not contained in the MultiView control. |
Use the SetActiveView method to specify a View control within a MultiView control as the active view.
Only one View control at a time can be defined as active within a MultiView control. The View control that is set as the active view is rendered to the client.
If a View control that does not exist within the MultiView control is set as active, an exception is raised at run time. If no View control is set as the active view, the MultiView control does not render any content to the client.
Using the SetActiveView method to programmatically set the active view allows the application to determine which View control to render to the client at run time based on criteria such as a user's identity and preferences.
Alternatively, the MultiView includes the ActiveViewIndex property to set or get the zero-based index of the current active view in a MultiView control. This property can be accessed either declaratively or programmatically.
The following examples demonstrate using the SetActiveView method to set the active view in a MultiView control.
ActiveViewIndex Property Navigating Views in the MultiView Control