A collection of RadMenuItem objects in a RadMenu control.
The RadMenuItemCollection class represents a collection of RadMenuItem objects. The RadMenuItem objects in turn represent menu items within a RadMenu control.
- Use the this[int] to programmatically retrieve a single RadMenuItem from the collection, using array notation.
- Use the Count property to determine the total number of menu items in the collection.
- Use the Add(RadMenuItem) method to add menu items in the collection.
- Use the Remove(RadMenuItem) method to remove menu items from the collection.
Definition
Namespace:Telerik.Web.UI
Assembly:Telerik.Web.UI.dll
Syntax:
public class RadMenuItemCollection : ControlItemCollection, IList, ICollection, IStateManager, IList<RadMenuItem>, ICollection<RadMenuItem>, IEnumerable<RadMenuItem>, IEnumerable
Inheritance: objectStateManagedCollectionControlItemCollectionRadMenuItemCollection
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadMenuItemCollection class.
public RadMenuItemCollection(Control parent)
The owner of the collection.
Properties
Gets the RadMenuItem object at the specified index in the current RadMenuItemCollection.
public RadMenuItem this[int index] { get; set; }
The zero-based index of the RadMenuItem to retrieve.
Property Value:The RadMenuItem at the specified index in the current RadMenuItemCollection.
Methods
Appends the specified RadMenuItem object to the end of the current RadMenuItemCollection.
public virtual void Add(RadMenuItem item)
The RadMenuItem to append to the end of the current RadMenuItemCollection.
Appends the specified array of RadMenuItem objects to the end of the current RadMenuItemCollection.
public virtual void AddRange(IEnumerable<RadMenuItem> items)
The array of RadMenuItem to append to the end of the current RadMenuItemCollection.
Determines whether the specified RadMenuItem object is in the current RadMenuItemCollection.
public virtual bool Contains(RadMenuItem item)
The RadMenuItem object to find.
Returns:true if the current collection contains the specified RadMenuItem object;
otherwise, false.
Copies the contents of the current RadMenuItemCollection into the specified array of RadMenuItem objects.
public virtual void CopyTo(RadMenuItem[] array, int index)
The target array.
indexintThe index to start copying from.
Returns the first RadMenuItem that matches the conditions defined by the specified predicate. The predicate should returns a boolean value.
public RadMenuItem FindItem(Predicate<RadMenuItem> match)
The Predicate <> that defines the conditions of the element to search for.
Returns:Searches the items in the collection for a RadMenuItem which contains the specified attribute and attribute value.
public RadMenuItem FindItemByAttribute(string attributeName, string attributeValue)
The name of the target attribute.
attributeValuestringThe value of the target attribute
Returns:The RadMenuItem that matches the specified arguments. Null (Nothing) is returned if no node is found.
This method is not recursive.
Searches the RadMenu control for the first RadMenuItem with a Text property equal to the specified value.
public RadMenuItem FindItemByText(string text, bool ignoreCase)
The value to search for.
ignoreCaseboolA Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).
Returns:A RadMenuItem whose Text property is equal to the specified value.
The method returns the first item matching the search criteria. If no item is matching then null (Nothing in VB.NET) is returned.
Searches the RadMenuItemCollection control for the first RadMenuItem with a Text property equal to the specified value.
public RadMenuItem FindItemByText(string text)
The value to search for.
Returns:A RadMenuItem whose Text property is equal to the specified value.
The method returns the first item matching the search criteria. This method is not recursive. If no item is matching then null (Nothing in VB.NET) is returned.
Searches the RadMenu control for the first RadMenuItem with a Value property equal to the specified value.
public RadMenuItem FindItemByValue(string value, bool ignoreCase)
The value to search for.
ignoreCaseboolA Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).
Returns:A RadMenuItem whose Value property is equal to the specified value.
The method returns the first item matching the search criteria. If no item is matching then null (Nothing in VB.NET) is returned.
Searches the RadMenuItemCollection control for the first RadMenuItem with a Value property equal to the specified value.
public RadMenuItem FindItemByValue(string value)
The value to search for.
Returns:A RadMenuItem whose Value property is equal to the specified value.
The method returns the first item matching the search criteria. This method is not recursive. If no item is matching then null (Nothing in VB.NET) is returned.
Determines the index of the specified RadMenuItem object in the collection.
public virtual int IndexOf(RadMenuItem item)
The RadMenuItem to locate.
Returns:The zero-based index of item within the current RadMenuItemCollection, if found; otherwise, -1.
Inserts the specified RadMenuItem object in the current RadMenuItemCollection at the specified index location.
public virtual void Insert(int index, RadMenuItem item)
The zero-based index location at which to insert the RadMenuItem.
itemRadMenuItemThe RadMenuItem to insert.
Removes the specified RadMenuItem object from the current RadMenuItemCollection.
public virtual void Remove(RadMenuItem item)
The RadMenuItem object to remove.
Removes the RadMenuItem object at the specified index from the current RadMenuItemCollection.