Adding a C1TabStrip Control to Your Project in Code
In some instances, you may want to add a C1TabStrip control to your project in code. In this topic, you will learn how to create a C1TabStrip control with three C1Tab objects using C# and Visual Basic code.
Complete the following steps:
1. Add a PlaceHolder control to your Web page.
2. In Design view, double-click the page to add a Page_Load event to the project and to switch to the code editor.
3. Import the following namespace into your project:
Imports C1.Web.UI.Controls.C1TabStrip
• C#
using C1.Web.UI.Controls.C1TabStrip;
4. Create the C1TabStrip object and add it to your project by placing the following code in the Page_Load event:
Dim NewTabStrip As C1TabStrip = New C1TabStrip()
PlaceHolder1.Controls.Add(NewTabStrip)
• C#
C1TabStrip NewTabStrip = new C1TabStrip();
PlaceHolder1.Controls.Add(NewTabStrip);
5. Create three C1Tab objects and add them to the C1TabStrip control. This code should also be added to the Page_Load event.
'Create three C1Tab objects and set their 'Text' property
Dim C1Tab1 As C1Tab = New C1Tab("C1Tab1")
Dim C1Tab2 As C1Tab = New C1Tab("C1Tab2")
Dim C1Tab3 As C1Tab = New C1Tab("C1Tab3")
'Add the three C1Tab objects to the C1TabStrip
NewTabStrip.Tabs.Add(C1Tab1)
NewTabStrip.Tabs.Add(C1Tab2)
NewTabStrip.Tabs.Add(C1Tab3)
• C#
//Create three C1Tab objects and set their 'Text' property
C1Tab C1Tab1 = new C1Tab("C1Tab1");
C1Tab C1Tab2 = new C1Tab("C1Tab2");
C1Tab C1Tab3 = new C1Tab("C1Tab3");
//Add the three C1Tab objects to the C1TabStrip
NewTabStrip.Tabs.Add(C1Tab1);
NewTabStrip.Tabs.Add(C1Tab2);
NewTabStrip.Tabs.Add(C1Tab3);
6. Run the program.
This Topic Illustrates the Following:
After you've run the program, your C1TabStrip control will resemble the following image:
|