ComponentOne TabStrip for ASP.NET AJAX: TabStrip for ASP.NET AJAX Task-Based Help > Setting C1TabStrip Behaviors > Changing the Selected Index

Changing the Selected Index

The SelectedIndex property of a C1TabStrip 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, Source view, and in code.

Note: If you change the SelectedIndex property on a C1TabStrip and have it bound to a C1MultiPage, you will also have to manipulate C1MultiPage's SelectedIndex property in order to get your tab to load with the correct page view.

In Design View

Complete the following steps:

1.   Click C1TabStrip's smart tag () to open the C1TabStrip Tasks menu and then select TabStrip Designer.

      The C1TabStrip Designer Form appears.

2.   Use the Add Child Item button  to add three tabs to the C1TabStrip control.

3.   Select C1TabStrip from the treeview to reveal its list of properties.

4.   Locate the SelectedIndex property and set its value to "1". Since a C1TabStrip control uses a zero-based index, the project will load with the second tab selected.

5.   Press OK and run the program. Observe that the second tab, C1Tab2, has focus at run-time. 

In Source View

Add SelectedIndex="1" to the <cc1:C1TabStrip> tag. The resulting HTML should resemble the following:

 

<cc1:C1TabStrip ID="C1TabStrip1" runat="server" Height="29px" VisualStyle="Office2007Blue"

                VisualStylePath="~/C1WebControls/VisualStyles" SelectedIndex="1">

In Code

Complete the following steps:

      Visual Basic

Me.C1TabStrip1.SelectedIndex = 1

      C#

this.C1TabStrip1.SelectedIndex = 1;


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.