Tabs for ASP.NET WebForms
Changing the Selected Index
Task-Based Help > Changing the Selected Index

The Selected property of a C1Tabs control can be used to determine which tab will be selected when your project is run. The following topic shows you how to set this property in Design view, in Source view, and in code.

In Design View

Complete the following steps:

  1. Click C1Tabs's smart tag (C1Tabs) to open the C1Tabs Tasks menu and select Tabs Designer.
    The C1Tabs Designer Form appears.
  2. Use the Add Child Item button C1Tabsto add three pages to your C1Tabs.
  3. Select C1Tabs from the treeview to reveal its list of properties.
  4. Locate the Selected property and set its value to "1".

    Note: Observe that the default value of the SelectedIndex property is 0. If you had kept this setting, your C1Tabs would have loaded with the first tab, C1TabPage1, selected.

  5. Press OK and then run the project. Observe that the second tab page, C1TabPage2, is selected at run-time.

In Source View

Add Selected="1" to the <cc1:C1Tabs> tag. The resulting XHTML should resemble the following:

To write code in Source View

<cc1:C1Tabs ID="C1Tabs1" runat="server" Height="29px" VisualStyle="Office2007Blue"
                VisualStylePath="~/C1WebControls/VisualStyles" SelectedIndex="1">

In Code

Complete the following steps:

  1. Add the following code to the Page_Load event:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    C1Tabs1.SelectedIndex = 1
    

    To write code in C#

    C#
    Copy Code
    C1Tabs1.SelectedIndex = 1;
    
  2. Press F5 to run the project.