Controls You Can Use on Web Forms ASP.NET Navigation Controls Menu Control
The Menu control exposes an Items collection, which comprise the root MenuItem objects defined for the control.
Root menu items can be configured programmatically, by creating new instances of the MenuItem class and adding them to the Items collection in the order that they will appear in the menu structure.
MenuItem newItem = new MenuItem ( menuitemText, menuItemValue );
newItem.NavigateUrl = webPageUrl;
menuObject.Items.Add ( newItem );
In the same manner, each MenuItem object exposes a ChildItems collection, which comprise the child MenuItem objects, if any, defined for that particular menu item.
Likewise, child menu items can be configured programmatically, by creating new instances of the MenuItem class and adding them to the ChildItems collection of the parent node, in the order that they will appear in the menu structure.
MenuItem newItem = new MenuItem ( menuitemText, menuItemValue );
newItem.NavigateUrl = webPageUrl;
parentMenuItemObject.ChildItems.Add ( newItem );
The following example demonstrates how to populate the contents of a Menu control dynamically.
Note that while a Menu control cannot be directly bound to a non-hierarchical data source, such as a database table, it can be made to display the contents of a database table using the above concepts.
Show me
Binding a Menu Control to a Data Source Customizing the Menu Control User Interface