System.Web.UI.WebControls.View Class

Represents a control that acts as a container for a group of controls within a System.Web.UI.WebControls.MultiView control.

See Also: View Members


[System.Web.UI.ToolboxData("<{0}:View runat="server"></{0}:View>")]
[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.ViewDesigner, System.Design, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
public class View : System.Web.UI.Control


In this topic:


The System.Web.UI.WebControls.View control is a container for a group of controls. A System.Web.UI.WebControls.View control must always be contained within a System.Web.UI.WebControls.MultiView control. Only one System.Web.UI.WebControls.View control at a time can be defined as the active view within a System.Web.UI.WebControls.MultiView control.

The MultiView.ActiveViewIndex property specifies the active System.Web.UI.WebControls.View control within the MultiView.Views collection of a System.Web.UI.WebControls.MultiView control. The active view control is rendered to the client, as long as the containing System.Web.UI.WebControls.MultiView control is visible. Use the View.Visible property to determine whether a System.Web.UI.WebControls.View control and its child controls are visible on the page and rendered to the client.

A System.Web.UI.WebControls.View control can contain controls of any type, including other System.Web.UI.WebControls.MultiView controls. A System.Web.UI.WebControls.View control does not support any style properties. To apply styles to a System.Web.UI.WebControls.View control, add one or more System.Web.UI.WebControls.Panel controls to the System.Web.UI.WebControls.View control.

The System.Web.UI.WebControls.View class provides the View.Activate and View.Deactivate events. The View.Activate event is raised when the current System.Web.UI.WebControls.View control becomes the active view. This occurs when the value of the MultiView.ActiveViewIndex property changes or the MultiView.SetActiveView(View) method is called to specify a different System.Web.UI.WebControls.View control. For example, if View1 is the active view within a System.Web.UI.WebControls.MultiView control, when the MultiView.ActiveViewIndex property changes to specify View2, the View.Activate event is raised for View2 and the View.Deactivate event is raised for View1.

To allow users to navigate between multiple System.Web.UI.WebControls.View controls within a System.Web.UI.WebControls.MultiView control, you can add a System.Web.UI.WebControls.LinkButton or System.Web.UI.WebControls.Button control to each System.Web.UI.WebControls.View control. Set the System.Web.UI.WebControls.LinkButton or System.Web.UI.WebControls.Button control's CommandName property to the ID of the System.Web.UI.WebControls.View control to navigate to. For a code example, see MultiView.ActiveViewChanged.

For more information on manipulating System.Web.UI.WebControls.View controls within a System.Web.UI.WebControls.MultiView control, see the System.Web.UI.WebControls.MultiView topic.

Declarative Syntax




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