ASPxClientTabControlBase.SetActiveTab(tab) Method
Makes the specified tab active within the tab control on the client side.
Declaration
SetActiveTab(
tab: ASPxClientTab
): void
Parameters
Name | Type | Description |
---|---|---|
tab | ASPxClientTab | An ASPxClientTab object specifying the tab to select. |
Remarks
End users are allowed to select tabs via mouse clicks. The tab control also provides the ability to select tabs on the client side via code. You can use the SetActiveTab method for this purpose.
Note that a tab control always has the active tab and only one tab can be active within the control at the same time. So the SetActiveTab method is in effect if it’s passed a correct tab index which lies in the range of 0 to the ASPxClientTabControlBase.GetTabCount value decremented by one.
Example
This example demonstrates how to use the ASPxPageControl.ShowTabs property. The ASPxPageControl has three tab pages, selected by clicking the ASPxNavBar‘s item client.
<dxtc:ASPxPageControl ID="ASPxPageControl1" runat="server" ActiveTabIndex="0"
ClientInstanceName="PageControl1" Height="101px" ShowTabs="False" Width="228px">
<TabPages>
<dxtc:TabPage Text="Tab1">
<ContentCollection>
<dxw:ContentControl runat="server">
Page1 content
</dxw:ContentControl>
</ContentCollection>
</dxtc:TabPage>
<dxtc:TabPage Text="Tab2">
<ContentCollection>
<dxw:ContentControl runat="server">
Page2 content
</dxw:ContentControl>
</ContentCollection>
</dxtc:TabPage>
<dxtc:TabPage Text="Tab3">
<ContentCollection>
<dxw:ContentControl runat="server">
Page3 content
</dxw:ContentControl>
</ContentCollection>
</dxtc:TabPage>
</TabPages>
</dxtc:ASPxPageControl>
<dxnb:ASPxNavBar ID="ASPxNavBar1" runat="server" AllowSelectItem="True">
<Groups>
<dxnb:NavBarGroup>
<Items>
<dxnb:NavBarItem Text="Item1" Selected="True">
</dxnb:NavBarItem>
<dxnb:NavBarItem Text="Item2">
</dxnb:NavBarItem>
<dxnb:NavBarItem Text="Item3">
</dxnb:NavBarItem>
</Items>
</dxnb:NavBarGroup>
</Groups>
<ClientSideEvents ItemClick="function(s, e) {
switch(e.item.index)
{
case 0: {PageControl1.SetActiveTab(PageControl1.GetTab(0)); break;}
case 1: {PageControl1.SetActiveTab(PageControl1.GetTab(1)); break;}
case 2: {PageControl1.SetActiveTab(PageControl1.GetTab(2)); break;}
}
}" />
</dxnb:ASPxNavBar>
...