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

Creating a C1WebToolBar Programmatically

To programmatically create a toolbar and toolbar item , complete the following:

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 C1WebToolBarGroup, use the following code:

·      Visual Basic

'First create an instance of the class

Dim toolbar As New C1.Web.Command.C1WebToolBar()

'Add the toolbar to the placeholder control

PlaceHolder1.Controls.Add(toolbar)

'create the C1WebToolBarGroup

toolbar.Groups.Add(New C1WebToolBarGroup())

·      C#

//First create an instance of the class

C1WebToolBarGroup toolbar = new C1WebToolBarGroup();

//Add the topicbar to the placeholder control

PlaceHolder1.Controls.Add(toolbar);

//Create the C1WebToolBarGroup

toolbar.Groups.Add(new C1WebToolBarGroup());

·      Delphi

var

  toolbar: C1WebToolBar;

 

begin

  toolbar := C1WebToolBar.Create;

  //Add the C1WebToolBar control to the PlaceHolder control

  PlaceHolder1.Controls.Add(toolbar);

  toolbar.Groups.Add(C1WebToolbarGroup.Create());

4.   To programmatically add a C1WebToolBarItem to C1WebToolBar, use the following code:

·      Visual Basic

' Create the C1WebToolBarItem

toolbar.Groups(0).Items.Add(New C1WebToolBarItem("Item 1"))

·      C#

//Create the C1WebToolBarItem

toolbar.Groups[0].Items.Add(new C1WebToolBarItem("Item 1"));

·      Delphi

//Create the C1WebToolBarItem

toolbar.Groups[0].Items.Add(C1WebToolBarItem.Create('Item 1'));


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