ComponentOne WebMenus and WebBars for ASP.NET (2.0) Search HelpCentral 

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.   Import the C1.Web.Command namespace to your source code.

·      Visual Basic

Imports C1.Web.Command

·      C#

using C1.Web.Command;

·      Delphi

uses C1.Web.Command;

3.   To programmatically create a C1WebTopicBarGroup, complete the following:

·      Visual Basic

'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"));

·      Delphi

var

  topicbar: C1WebTopicBar;

begin

  topicbar := C1WebTopicBar.Create;

  //Add the C1WebTopicBar control to the PlaceHolder control

  PlaceHolder1.Controls.Add(topicbar);

  topicbar.Groups.Add(C1WebTopicBarGroup.Create('Group 1'));

4.   To programmatically create a C1WebTopicBarItem, complete the following:

·      Visual Basic

' 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"));

·      Delphi

//Create the C1WebTopicBarItem

topicbar.Groups[0].Items.Add(C1WebTopicBarItem.Create('Item 1', 'http://www.google.com'));


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