RadTabStrip for ASP.NET AJAX

RadControls for ASP.NET AJAX

Using the server-side API, you can programmatically add, remove, and edit the tabs in a tab strip.

Adding tabs on page load

After adding a RadTabStrip control to your Web page, you can use the following server-side code to add tabs when the page loads:

 

Adding tabs dynamically

You can dynamically update the Tabs collection of RadTabStrip and RadTab in response to a postback as well. Consider the following tab strip declaration:

CopyASPX
 

<telerik:RadTabStrip
  ID="RadTabStrip1"
  runat="server"
  Skin="Web20"
  OnTabClick="RadTabStrip1_TabClick">
  <Tabs>
    <telerik:RadTab runat="server"
       Text="Add Root Tab"
       Value="R">
    </telerik:RadTab>
    <telerik:RadTab runat="server"
       Text="Add child Tab"
       Value="C">
    </telerik:RadTab>
  </Tabs>
</telerik:RadTabStrip>

The TabClick event handler adds tabs dynamically at runtime in the post-back:

 

Clicking on both menu items results in the following:

Dynamic add

Removing, disabling, and enabling items

To remove a tab in server-side code, use the Remove method of the RadTabCollection object that contains it. To enable or disable a tab, use the Enabled property of the RadTab object itself. The following example demonstrates these techniques.

Consider the following tab strip:

CopyASPX
 

<telerik:RadTabStrip
     ID="RadTabStrip1"
     runat="server"
     OnTabClick="RadTabStrip1_TabClick">
  <Tabs>
    <telerik:RadTab
        runat="server"
        Text="Delete a Tab"
        Value="D">
      <Tabs>
        <telerik:RadTab
runat="server" Text="Child 1" />
        <telerik:RadTab
runat="server" Text="Child 2" />
        <telerik:RadTab
runat="server" Text="Child 3" />
        <telerik:RadTab
runat="server" Text="Child 4" />
      </Tabs>
    </telerik:RadTab>
    <telerik:RadTab
        runat="server"
        Text="Disable a Tab"
        Value="E">
      <Tabs>
        <telerik:RadTab
runat="server" Text="Child 1" />
        <telerik:RadTab
runat="server" Text="Child 2" />
        <telerik:RadTab
runat="server" Text="Child 3" />
        <telerik:RadTab
runat="server" Text="Child 4" />
      </Tabs>
    </telerik:RadTab>
  </Tabs>
</telerik:RadTabStrip>

The TabClick event handler deletes, disables, and enables tabs dynamically at runtime in the post-back when child tabs are clicked. It deletes children of the first root tab and disables the selected child tab of the second root tab, enabling all of its siblings:

 

See Also