New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

A collection of RadToolBarItem objects in a RadToolBar control.

The RadToolBarItemCollection class represents a collection of RadToolBarItem objects. The RadToolBarItem objects in turn represent items (buttons, dropdowns or split buttons) within a RadToolBar control.

  • Use the this[int] to programmatically retrieve a single RadToolBarItem from the collection, using array notation.
  • Use the Count property to determine the total number of toolbar items in the collection.
  • Use the Add(RadToolBarItem) method to add toolbar items to the collection.
  • Use the Remove(RadToolBarItem) method to remove toolbar items from the collection.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
public class RadToolBarItemCollection : ControlItemCollection, IList, ICollection, IEnumerable, IStateManager

Inheritance: objectStateManagedCollectionControlItemCollectionRadToolBarItemCollection

Derived Classes: RadToolBarButtonCollection

Implements: ICollectionIEnumerableIListIStateManager

Inherited Members ControlItemCollection.VisibleChildren<T>()ControlItemCollection.Add(ControlItem)ControlItemCollection.Contains(ControlItem)ControlItemCollection.CopyTo(ControlItem[], int)ControlItemCollection.AddRange(IEnumerable<ControlItem>)ControlItemCollection.IndexOf(ControlItem)ControlItemCollection.Insert(int, ControlItem)ControlItemCollection.Remove(ControlItem)ControlItemCollection.FindChild<TControlItem>(Predicate<TControlItem>)ControlItemCollection.FindChildByText<TControlItem>(string)ControlItemCollection.FindChildByValue<TControlItem>(string)ControlItemCollection.FindChildByAttribute<TControlItem>(string, string)ControlItemCollection.FindChildByValue<TControlItem>(string, bool)ControlItemCollection.FindChildByText<TControlItem>(string, bool)ControlItemCollection.AddItemToParentControls(int, ControlItem)ControlItemCollection.OnInsertComplete(int, object)ControlItemCollection.OnRemoveComplete(int, object)ControlItemCollection.OnClear()ControlItemCollection.SetDirtyObject(object)ControlItemCollection.ParentControlItemCollection.VisibleItemsControlItemCollection.ListStateManagedCollection.Clear()StateManagedCollection.CopyTo(Array, int)StateManagedCollection.CreateKnownType(int)StateManagedCollection.GetEnumerator()StateManagedCollection.GetKnownTypes()StateManagedCollection.OnClearComplete()StateManagedCollection.OnValidate(object)StateManagedCollection.OnInsert(int, object)StateManagedCollection.OnRemove(int, object)StateManagedCollection.SetDirty()StateManagedCollection.Countobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

Initializes a new instance of the RadToolBarItemCollection class.

C#
public RadToolBarItemCollection(Control parent)
Parameters:parentControl

The owner of the collection.

Properties

Gets the RadToolBarItem object at the specified index in the current RadToolBarItemCollection.

C#
public RadToolBarItem this[int index] { get; }
Parameters:indexint

The zero-based index of the RadToolBarItem to retrieve.

Property Value:

The RadToolBarItem at the specified index in the current RadToolBarItemCollection.

Methods

Appends the specified RadToolBarItem object to the end of the current RadToolBarItemCollection.

C#
public void Add(RadToolBarItem item)
Parameters:itemRadToolBarItem

The RadToolBarItem to append to the end of the current RadToolBarItemCollection.

Example:
cs-api-definition
RadToolBarButton createNewButton = new RadToolBarButton("CreateNew");
RadToolBar1.Items.Add(createNewButton);

Appends the specified array of RadToolBarItem objects to the end of the current RadToolBarItemCollection.

C#
public void AddRange(IEnumerable<RadToolBarItem> items)
Parameters:itemsIEnumerable<RadToolBarItem>

The array of RadToolBarItem objects to append to the end of the current RadToolBarItemCollection.

Example:
cs-api-definition
RadToolBarItem[] items = new RadToolBarItem[] { new RadToolBarButton("Create New"),
new RadToolBarDropDown("Manage"),
new RadToolBarSplitButton("Register Purchase")};
RadToolBar1.Items.AddRange(items);

Determines whether the specified RadToolBarItem object is in the current RadToolBarItemCollection.

C#
public bool Contains(RadToolBarItem item)
Parameters:itemRadToolBarItem

The RadToolBarItem object to find.

Returns:

bool

true if the current collection contains the specified RadToolBarItem object; otherwise, false.

Returns the first RadToolBarItem that matches the conditions defined by the specified predicate. The predicate should returns a boolean value.

C#
public RadToolBarItem FindItem(Predicate<RadToolBarItem> match)
Parameters:matchPredicate<RadToolBarItem>

The Predicate <> that defines the conditions of the element to search for.

Returns:

RadToolBarItem

Example:
cs-api-definition
void Page_Load(object sender, EventArgs e)
{
RadToolBar1.FindItem(ItemWithEqualsTextAndValue);
}
private static bool ItemWithEqualsTextAndValue(RadToolBarItem item)
{
if (item.Text == item.Value)
{
return true;
}
else
{
return false;
}
}

Searches the items in the collection for a RadToolBarItem which contains the specified attribute and attribute value.

C#
public RadToolBarItem FindItemByAttribute(string attributeName, string attributeValue)
Parameters:attributeNamestring

The name of the target attribute.

attributeValuestring

The value of the target attribute

Returns:

RadToolBarItem

The RadToolBarItem that matches the specified arguments. Null (Nothing) is returned if no node is found.

This method is not recursive.

Searches the ToolBarItemCollection for the first RadToolBarItem with a Text property equal to the specified value.

C#
public RadToolBarItem FindItemByText(string text, bool ignoreCase)
Parameters:textstring

The value to search for.

ignoreCasebool

A Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).

Returns:

RadToolBarItem

A RadToolBarItem which 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 ToolBarItemCollection for the first RadToolBarItem with a Text property equal to the specified value.

C#
public RadToolBarItem FindItemByText(string text)
Parameters:textstring

The value to search for.

Returns:

RadToolBarItem

A RadToolBarItem which 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 ToolBarItemCollection for the first button item (RadToolBarButton or RadToolBarSplitButton) with a Value property equal to the specified value.

C#
public RadToolBarItem FindItemByValue(string value, bool ignoreCase)
Parameters:valuestring

The value to search for.

ignoreCasebool

A Boolean indicating a case-sensitive or insensitive comparison (true indicates a case-insensitive comparison).

Returns:

RadToolBarItem

A button item which 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.

Searches the ToolBarItemCollection for the first button item (RadToolBarButton or RadToolBarSplitButton) with a Value property equal to the specified value.

C#
public RadToolBarItem FindItemByValue(string value)
Parameters:valuestring

The value to search for.

Returns:

RadToolBarItem

A button item which 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 RadToolBarItem object in the collection.

C#
public int IndexOf(RadToolBarItem item)
Parameters:itemRadToolBarItem

The RadToolBarItem to locate.

Returns:

int

The zero-based index of a toolbar item within the current RadToolBarItemCollection, if found; otherwise, -1.

Inserts the specified RadToolBarItem object in the current RadToolBarItemCollection at the specified index location.

C#
public void Insert(int index, RadToolBarItem item)
Parameters:indexint

The zero-based index location at which to insert the RadToolBarItem.

itemRadToolBarItem

The RadToolBarItem to insert.

Removes the specified RadToolBarItem object from the current RadToolBarItemCollection.

C#
public void Remove(RadToolBarItem item)
Parameters:itemRadToolBarItem

The RadToolBarItem object to remove.

Removes the RadToolBarItem object at the specified index from the current RadToolBarItemCollection.

C#
public void RemoveAt(int index)
Parameters:indexint

The zero-based index of the item to remove.

C#
protected override void SetOwner(ControlItem item)
Parameters:itemControlItem

Overrides: ControlItemCollection.SetOwner(ControlItem)