This topic shows how to create C1WebTabStrip group and an item through code. For more details about programmatically creating additional groups and items and creating styles for the C1WebTabStrip, see the tutorial, Creating a C1WebTabStrip in Code.
1. Add a PlaceHolder control to the Web form.
2. Import the C1.Web.Command namespace to your source code.
Imports C1.Web.Command
· C#
using C1.Web.Command;
· Delphi
uses C1.Web.Command;
3. To programmatically create a C1WebTabStripGroup use the following code:
'First create an instance of the class
Dim tabstrip As New C1.Web.Command.C1WebTabStrip()
'Add the tabstrip to the placeholder control
PlaceHolder1.Controls.Add(tabstrip)
'create the C1WebTabStripGroup
tabstrip.Groups.Add(New C1WebTabStripGroup("Tab 1"))
· C#
//First create an instance of the class
C1WebTabStrip tabstrip = new C1WebTabStrip();
//Add the topicbar to the placeholder control
PlaceHolder1.Controls.Add(tabstrip);
//Create the C1WebTopicBarGroup
tabstrip.Groups.Add(new C1WebTabStripGroup("Tab 1"));
· Delphi
var
tabstrip: C1WebTabStrip;
begin
tabstrip := C1WebTabStrip.Create;
//Add the C1WebTabStrip control to the PlaceHolder control
PlaceHolder1.Controls.Add(tabstrip);
tabstrip.Groups.Add(C1WebTabStripGroup.Create('Tab 1'));
4. To programmatically create a C1WebTabStripItem, complete the following:
' Create the C1WebTabStrip Item
tabstrip.Groups(0).Items.Add(New C1WebTabStripItem("Item 1", "http://www.google.com"))
· C#
//Create the C1WebTabStripItem
tabstrip.Groups[0].Items.Add(new C1WebTabStripItem("Item 1", @"http://www.google.com"));
· Delphi
//Create the C1WebTabStripItem
tabstrip.Groups[0].Items.Add(C1WebTabStrip.Create('Item 1', 'http://www.google.com'));
Send comments about this topic to ComponentOne. Copyright © ComponentOne LLC. All rights reserved. |