Creating a C1WebTopicBar Programmatically
To create a C1WebTopicBarGroup and C1WebTopicBarItem programmatically, complete the following steps:
1. Add a PlaceHolder control to the Web page.
2. Add the following Import or Using directives for the C1.Web.Command namespace to your source code.
Imports C1.Web.Command
• C#
using C1.Web.Command;
3. To programmatically create a C1WebTopicBarGroup, complete the following:
'First create an instance of the class
Dim topicbar As New C1WebTopicBar()
'Add the topicbar to the placeholder control
PlaceHolder1.Controls.Add(topicbar)
'create the C1WebTopicBarGroup
topicbar.Groups.Add(New C1WebTopicBarGroup("Group 1"))
• C#
//First create an instance of the class
C1WebTopicBar topicbar = new C1WebTopicBar();
//Add the topicbar to the placeholder control
PlaceHolder1.Controls.Add(topicbar);
//Create the C1WebTopicBarGroup
topicbar.Groups.Add(new C1WebTopicBarGroup("Group 1"));
4. To programmatically create a C1WebTopicBarItem, complete the following:
' Create the C1WebTopicBarItem
topicbar.Groups(0).Items.Add(New C1WebTopicBarItem("Item 1", "http://www.google.com"))
• C#
//Create the C1WebTopicBarItem
topicbar.Groups[0].Items.Add(new C1WebTopicBarItem("Item 1", @"http://www.google.com"));
|