Represents a collection of System.Web.UI.WebControls.MenuItemBinding objects.
See Also: MenuItemBindingCollection Members
The System.Web.UI.WebControls.MenuItemBindingCollection class is used to store and manage a collection of System.Web.UI.WebControls.MenuItemBinding objects in the System.Web.UI.WebControls.Menu control. The System.Web.UI.WebControls.Menu control uses the System.Web.UI.WebControls.MenuItemBindingCollection class as the data type for its Menu.DataBindings property. The Menu.DataBindings property is used to store any menu item bindings defined for the System.Web.UI.WebControls.Menu control.
The order in which System.Web.UI.WebControls.MenuItemBinding objects appear in the collection has no effect on how those objects are applied to the menu items in a System.Web.UI.WebControls.Menu control.
The System.Web.UI.WebControls.MenuItemBindingCollection class supports several ways to access the items in the collection:
Use the MenuItemBindingCollection.Item(int) indexer to directly retrieve the System.Web.UI.WebControls.MenuItemBinding object at a specific zero-based index.
Use the System.Web.UI.StateManagedCollection.GetEnumerator method to create an enumerator that can be used to iterate through the collection.
Use the MenuItemCollection.CopyTo(MenuItem[], int) method to copy the contents of the collection into an array.
You can programmatically manage a System.Web.UI.WebControls.MenuItemBindingCollection object by adding and removing System.Web.UI.WebControls.MenuItemBinding objects. To add menu items to the collection, use the MenuItemBindingCollection.Add(MenuItemBinding) or the MenuItemBindingCollection.Insert(int, MenuItemBinding) method. To remove nodes from the collection, use the MenuItemBindingCollection.Remove(MenuItemBinding), the MenuItemBindingCollection.RemoveAt(int), or the System.Web.UI.StateManagedCollection.Clear method.
The System.Web.UI.WebControls.MenuItemBindingCollection class contains properties and methods that allow you to retrieve information about the collection itself. To find out how many items are in the collection, use the System.Web.UI.StateManagedCollection.Count property. If you want to determine whether the collection contains a certain System.Web.UI.WebControls.MenuItemBinding object, use the MenuItemBindingCollection.Contains(MenuItemBinding) method. To get the index of a System.Web.UI.WebControls.MenuItemBinding object in the collection, use the MenuItemBindingCollection.IndexOf(MenuItemBinding) method.