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

The RadToolBarButtonCollection class represents a collection of RadToolBarButton objects. The RadToolBarButton objects in turn represent buttons within a RadToolBarDropDown or a RadToolBarSplitButton.

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

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

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

Inheritance: objectStateManagedCollectionControlItemCollectionRadToolBarItemCollectionRadToolBarButtonCollection

Implements: ICollectionIEnumerableIListIStateManager

Inherited Members RadToolBarItemCollection.Add(RadToolBarItem)RadToolBarItemCollection.FindItemByText(string)RadToolBarItemCollection.FindItemByValue(string)RadToolBarItemCollection.FindItemByText(string, bool)RadToolBarItemCollection.FindItemByValue(string, bool)RadToolBarItemCollection.FindItemByAttribute(string, string)RadToolBarItemCollection.FindItem(Predicate<RadToolBarItem>)RadToolBarItemCollection.Contains(RadToolBarItem)RadToolBarItemCollection.AddRange(IEnumerable<RadToolBarItem>)RadToolBarItemCollection.IndexOf(RadToolBarItem)RadToolBarItemCollection.Insert(int, RadToolBarItem)RadToolBarItemCollection.Remove(RadToolBarItem)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 RadToolBarButtonCollection class.

C#
public RadToolBarButtonCollection(Control parent)
Parameters:parentControl

The owner of the collection.

Properties

Gets the RadToolBarButton object at the specified index in the current RadToolBarButtonCollection.

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

The zero-based index of the RadToolBarButton to retrieve.

Property Value:

The RadToolBarButton at the specified index in the current RadToolBarButtonCollection.

Methods

Appends the specified RadToolBarButton object to the end of the current RadToolBarButtonCollection.

C#
public void Add(RadToolBarButton item)
Parameters:itemRadToolBarButton

The RadToolBarButton to append to the end of the current RadToolBarButtonCollection.

Example:
cs-api-definition
RadToolBarDropDown manageDropDown = new RadToolBarDropDown("Manage");

RadToolBarButton manageUsersButton = new RadToolBarButton("Users");
manageDropDown.Buttons.Add(manageUsersButton);

RadToolBarButton manageOrdersButton = new RadToolBarButton("Orders");
manageDropDown.Buttons.Add(manageOrdersButton);

RadToolBar1.Items.Add(manageDropDown);

Appends the specified array of RadToolBarButton objects to the end of the current RadToolBarButtonCollection.

C#
public void AddRange(IEnumerable<RadToolBarButton> buttons)
Parameters:buttonsIEnumerable<RadToolBarButton>

The array of RadToolBarButton objects to append to the end of the current RadToolBarButtonCollection.

Example:
cs-api-definition
RadToolBarDropDown manageDropDown = new RadToolBarDropDown("Manage");
RadToolBarButton[] buttons = new RadToolBarButton[] { new RadToolBarButton("Users"),
new RadToolBarButton("Orders")};

manageDropDown.Buttons.AddRange(buttons);

RadToolBar1.Items.Add(manageDropDown);

Determines whether the specified RadToolBarButton object is in the current RadToolBarButtonCollection.

C#
public bool Contains(RadToolBarButton button)
Parameters:buttonRadToolBarButton

The RadToolBarButton object to find.

Returns:

bool

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

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

C#
public RadToolBarButton FindButtonByAttribute(string attributeName, string attributeValue)
Parameters:attributeNamestring

The name of the target attribute.

attributeValuestring

The value of the target attribute

Returns:

RadToolBarButton

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

This method is not recursive.

Searches the RadToolBarButtonCollection for the first RadToolBarButton with a Text property equal to the specified value.

C#
public RadToolBarButton FindButtonByText(string text)
Parameters:textstring

The value to search for.

Returns:

RadToolBarButton

A RadToolBarButton 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 RadToolBarButtonCollection for the first RadToolBarButton with a Value property equal to the specified value.

C#
public RadToolBarButton FindButtonByValue(string value)
Parameters:valuestring

The value to search for.

Returns:

RadToolBarButton

A RadToolBarButton 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 RadToolBarButton object in the collection.

C#
public int IndexOf(RadToolBarButton button)
Parameters:buttonRadToolBarButton

The RadToolBarButton to locate.

Returns:

int

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

Inserts the specified RadToolBarButton object in the current RadToolBarButtonCollection at the specified index location.

C#
public void Insert(int index, RadToolBarButton button)
Parameters:indexint

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

buttonRadToolBarButton

The RadToolBarButton to insert.

Removes the specified RadToolBarButton object from the current RadToolBarButtonCollection.

C#
public void Remove(RadToolBarButton button)
Parameters:buttonRadToolBarButton

The RadToolBarButton object to remove.

Removes the RadToolBarButton object at the specified index from the current RadToolBarButtonCollection.

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

The zero-based index of the button to remove.

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

Overrides: RadToolBarItemCollection.SetOwner(ControlItem)