asp.net.ph

MenuItem.ChildItems Property

System.Web.UI.WebControls Namespace   MenuItem Class


.NET Framework version 2.0

Returns a collection of MenuItem objects that represents the first-level child menu items of the current node in a Menu control.

Syntax


Script [ MenuItemCollection variable = ] MenuItem.ChildItems

Property Value


variable Returns a MenuItemCollection that contains the first-level child menu items of the current node in a Menu.

The property is read only with no default value.

Remarks

Use the ChildItems collection to programmatically obtain information about each of the first-level child menu items of the current node in a Menu control. This collection is typically used to iterate through all the child menu items, or to access a specific child menu item, of the current node.

The ChildItems property can also be used to programmatically add, insert, or remove MenuItem objects in the collection. Any updates to the collection are automatically reflected in the MenuItem control after the next round trip to the server.

To access the child menu items further down the tree, use the ChildItems property of the next-level child menu item to navigate down the menu hierarchy.

Example

The following example shows how to programmatically add child menu item objects to the ChildItems collection of a root or parent MenuItem control.

MenuItem newItem = new MenuItem ( menuItemText, menuItemValue );
newItem.NavigateUrl = webPageUrl;
parentMenuObject.ChildItems.Add ( newItem );
  C# VB

 Show me 

See Also

MenuItem Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph