asp.net.ph

Multiview.ActiveViewIndex Property

System.Web.UI.WebControls Namespace   MultiView Class


Sets or retrieves the index of the active View control within a MultiView control.

Syntax


Inline <asp:multiview activeviewindex = intIndex ... >
Script Multiview.ActiveViewIndex [ = intIndex ]

Property Value


intIndex Integer specifying the zero-based ordinal index of the active View control within a MultiView control.

The property is read/write with a default value of -1, indicating that no view is set as active.

Exceptions


Exception Type Condition
ArgumentOutOfRangeException The given index is set to less than -1 or greater than or equal to the items count of the list.

Remarks

Views in a MultiView are indexed in the order in which they are declared within the document structure.

NOTE: Like most indexes in ASP.NET, ActiveViewIndex is zero-based, meaning the first item in the collection returns an index of 0.

Use the ActiveViewIndex property to specify or determine the index of the selected view within a MultiView.

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.

ActiveViewIndex returns a value of -1 if no item is selected, and the MultiView does not render any content to the client. If the ActiveViewIndex is set to a view that does not exist, an ArgumentOutOfRangeException is raised at run time.

The ActiveViewIndex can be set declaratively at design time or programmatically at run time.

Alternatively, the MultiView includes the SetActiveView and GetActiveView methods to set or get the active view within the MultiView control.

Example

The following examples demonstrate using the ActiveViewIndex property to set the active view in a MultiView control.

Nested MultiView Controls
Run Sample | View Source
Using the MultiView with the Toolbar WebControl
Run Sample | View Source
See Also

SetActiveView Method   GetActiveView Method   Navigating Views in the MultiView Control Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph