ComponentOne WebMenus and WebBars for ASP.NET: C1WebMenu Overview > Menu Item Types

Menu Item Types

C1WebMenu contains items and groups. The C1WebSubMenu class represents the groups. The C1WebLinkItem, C1WebContentItem, and C1WebSeparator classes represent the items. The items can be a link, custom content, or separator item.

Link Items

Link items are derived from the base class C1WebLinkItem. C1WebMenu's link items can easily be configured to represent a set of links by using  the NavigateUrl property. This property gets the URL link for the menu item. Please remember in menu items you can't specify both a ClientScripts and a NavigateUrl for the same link item.

To access the NavigateUrl property using the C1WebCommandEditor – C1WebMenu1 collection editor, follow the steps below:

1.   Right-click on C1WebMenu and select Edit from its C1WebMenu Tasks menu. The C1WebCommandEditor – C1WebMenu appears.

2.   Select an item from the tree view.

3.   Expand the Appearance node in the item's properties window.

There are five styles and states for the link items. Each style and state is determined by its property settings for Enabled and Selected.

 

Style

State

Property Settings

ItemStyle

Normal

Enabled = True, Selected = False, mouse doesn't hover over item.

MouseOverItemStyle

Mouse Over

Enabled = True, Selected = False, mouse hovers over item.

SelectedItemStyle

SelectedState

Enabled = True, Selected = True, mouse doesn't hover over item.

MouseOverSelectedItemStyle

Mouse Over Selected

Enabled = True, Selected = True, mouse hovers over item.

DisabledItemStyle

Disabled

Enabled = False

 

The item styles listed above are accessible programmatically through C1WebLinkItems object or by the design editor, C1WebCommandEditor – C1WebMenu Collection Editor. To access the C1WebLinkItem's style properties using the C1WebCommandEditor – C1WebMenu Collection Editor, follow the steps below:

 

1.   Right-click on C1WebMenu and select Edit from its C1WebMenu Tasks menu. The C1WebCommandEditor – C1WebMenu appears.

2.   Select an item from the tree view.

3.   Expand the Style node in the item's properties window.

 

To access the C1WebLinkItem object to apply properties to specific items, use the following code:

•      Visual Basic

'Create an instance of the class

Dim menu As C1WebMenu = New C1WebMenu

 

'Add to the page

menu.Layout = LayoutEnum.Horizontal

PlaceHolder1.Controls.Add(menu)

 

'set the style for the first menu item

CType(menu.Items(0), C1WebMenuItem).ItemStyle.BackColor = Color.Pink

•      C#

// create an instance of the class

C1WebMenu menu = new C1WebMenu();

 

//Add to the page

menu.Layout = LayoutEnum.Horizontal;

PlaceHolder1.Controls.Add(menu);

 

//set the style for the first menu item

((C1WebMenuItem)menu.Items[0]).ItemStyle.BackColor = Color.Pink;

Custom Content Items

Custom content items are derived from the base class C1WebContentItem. Each item includes content property. The Content property includes built-in editable templates and controls such as a calendar control.

Separators

C1WebMenu's items can be displayed as separators. Separators are also known as delimiters. The user has the option to customize the separators color, size, style, and padding. For more information about separator styles, please see Defining the Separator Style and its Types.


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