Skip to main content
A newer version of this page is available. .
Tab

ASPxTabControlBase.ActiveTabIndex Property

Gets or sets the index of a tab (tabbed page) which is selected within the control.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v18.2.dll

Declaration

[DefaultValue(-1)]
public int ActiveTabIndex { get; set; }

Property Value

Type Default Description
Int32 -1

An integer value specifying the index of an active tab (tabbed page) within the control’s ASPxTabControl.Tabs (ASPxPageControl.TabPages) collection.

Remarks

A tab control (which can be either the ASPxTabControl or ASPxPageControl) allows end users to select tabs via mouse clicks. In order to make a particular tab (tabbed page) active via code use the ActiveTabIndex property. This property specifies the active tab’s index within the ASPxTabControl.Tabs (ASPxPageControl.TabPages) collection of a tab control.

Note that a tab control always has an active tab and only one tab can be active within a tab control at a time.

You can also use the ASPxTabControl.ActiveTab (ASPxPageControl.ActiveTabPage) property to access and change an active tab (tabbed page) within a tab control.

Example

The complete sample project is available in the DevExpress Code Central database at E483.

...
         <dxtc:ASPxPageControl ID="ASPxPageControl1" runat="server" 
         ActiveTabIndex="0" ClientInstanceName="pageControl">
             <TabPages>
                 <dxtc:TabPage Text="Tab 1">
                     <ContentCollection>
                         <dxw:ContentControl runat="server">
                          <dxe:ASPxCheckBox ID="ASPxCheckBox1" runat="server" Text="Show Tab 2">
                                 <ClientSideEvents CheckedChanged="function(s, e) {
                var tab = pageControl.GetTab(1);
                var isVisible = s.GetChecked();
                tab.SetVisible(isVisible);
                }" />
                             </dxe:ASPxCheckBox>
                         </dxw:ContentControl>
                     </ContentCollection>
                 </dxtc:TabPage>
                 <dxtc:TabPage ClientVisible="False" Text="Tab 2">
                     <ContentCollection>
                         <dxw:ContentControl runat="server">
                             <dxe:ASPxLabel ID="ASPxLabel1" runat="server" Text="Label on Tab 2">
                             </dxe:ASPxLabel>
                         </dxw:ContentControl>
                     </ContentCollection>
                 </dxtc:TabPage>
             </TabPages>
         </dxtc:ASPxPageControl>
...

The following code snippets (auto-collected from DevExpress Examples) contain references to the ActiveTabIndex property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also