Changing the Selected Index
The SelectedIndex property of a C1TabControl 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
C1TabControl's smart tag () to open the C1TabControl Tasks menu and select
TabControl Designer.
The C1TabControl Designer Form appears.
2. Use the Add Child
Item button to add three pages to your C1TabControl.
3. Select C1TabControl from the treeview to reveal its list of properties.
4. Locate the SelectedIndex 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 C1TabControl 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 SelectedIndex="1" to the <cc1:C1TabControl> tag. The resulting XHTML should resemble the following:
<cc1:C1TabControl ID="C1TabControl1" runat="server" Height="29px" VisualStyle="Office2007Blue"
VisualStylePath="~/C1WebControls/VisualStyles" SelectedIndex="1">
In Code
To change the selected index, add the following code to the Page_Load event:
Me.C1TabControl1.SelectedIndex = 1
• C#
this.C1TabControl1.SelectedIndex = 1;
|