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

A collection of RadComboBoxItem objects in a RadComboBox control.

The RadComboBoxItemCollection class represents a collection of RadComboBoxItem objects.

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

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
public class RadComboBoxItemCollection : ControlItemCollection, IList, ICollection, IStateManager, IList<RadComboBoxItem>, ICollection<RadComboBoxItem>, IEnumerable<RadComboBoxItem>, IEnumerable

Inheritance: objectStateManagedCollectionControlItemCollectionRadComboBoxItemCollection

Implements: ICollectionICollection<RadComboBoxItem>IEnumerableIEnumerable<RadComboBoxItem>IListIList<RadComboBoxItem>IStateManager...

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.RemoveAt(int)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.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 RadComboBoxItemCollection class.

C#
public RadComboBoxItemCollection(Control parent)
Parameters:parentControl

The owner of the collection.

Properties

Gets the RadComboBoxItem object at the specified index in the current RadComboBoxItemCollection.

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

The zero-based index of the RadComboBoxItem to retrieve.

Property Value:

The RadComboBoxItem at the specified index in the current RadComboBoxItemCollection.

Implements: IList<RadComboBoxItem>.this[int]

Methods

Appends the specified RadComboBoxItem object to the end of the current RadComboBoxItemCollection.

C#
public virtual void Add(RadComboBoxItem item)
Parameters:itemRadComboBoxItem

The RadComboBoxItem to append to the end of the current RadComboBoxItemCollection.

Implements: ICollection<RadComboBoxItem>.Add(RadComboBoxItem)

Example:
cs-api-definition
RadComboBoxItem newsItem = new RadComboBoxItem("News");
RadComboBox1.Items.Add(newsItem);

Appends an item to the collection.

C#
public virtual void Add(string text)
Parameters:textstring

The text of the new item.

C#
protected override void AddItemToParentControls(int index, ControlItem item)
Parameters:indexintitemControlItem

Overrides: ControlItemCollection.AddItemToParentControls(int, ControlItem)

Appends the specified array of RadComboBoxItem objects to the end of the current RadComboBoxItemCollection.

C#
public virtual void AddRange(IEnumerable<RadComboBoxItem> items)

items

IEnumerable<RadComboBoxItem>

The array of <xref href="Telerik.Web.UI.RadComboBoxItem?text=RadComboBoxItem" data-throw-if-not-resolved="false"></xref> o append to the end of the current

RadComboBoxItemCollection.

Example:
cs-api-definition
RadComboBoxItem[] items = new RadComboBoxItem[] { new RadComboBoxItem("First"), new RadComboBoxItem("Second"), new RadComboBoxItem("Third") };
RadComboBox1.Items.AddRange(items);

Determines whether the specified RadComboBoxItem object is in the current RadComboBoxItemCollection.

C#
public virtual bool Contains(RadComboBoxItem item)
Parameters:itemRadComboBoxItem

The RadComboBoxItem object to find.

Returns:

bool

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

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

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

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

Returns:

RadComboBoxItem

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

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

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

The name of the target attribute.

attributeValuestring

The value of the target attribute

Returns:

RadComboBoxItem

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

This method is not recursive.

Finds the first RadComboBoxItem with Text that matches the given text value.

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

The string to search for.

ignoreCasebool

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

Returns:

RadComboBoxItem

The first RadComboBoxItem that matches the specified text value.

Example:
cs-api-definition
Dim item As RadComboBoxItem = RadComboBox1.FindItemByText("New York",true)

Finds the first RadComboBoxItem with Text that matches the given text value.

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

The string to search for.

Returns:

RadComboBoxItem

The first RadComboBoxItem that matches the specified text value.

This method is not recursive.

Finds the first RadComboBoxItem with Value that matches the given value.

C#
public RadComboBoxItem 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:

RadComboBoxItem

The first RadComboBoxItem that matches the specified value.

Example:
cs-api-definition
Dim item As RadComboBoxItem = RadComboBox1.FindItemByValue("1", true)

Finds the first RadComboBoxItem with Value that matches the given value.

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

The value to search for.

Returns:

RadComboBoxItem

The first RadComboBoxItem that matches the specified value.

This methods is not recursive.

Returns the index of the first RadComboBoxItem with Text that matches the given text value.

C#
public int FindItemIndexByText(string text, bool ignoreCase)
Parameters:textstring

The string to search for.

ignoreCasebool

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

Returns:

int

Returns the index of the first RadComboBoxItem with Text that matches the given text value.

C#
public int FindItemIndexByText(string text)
Parameters:textstring

The string to search for.

Returns:

int

Returns the index of the first RadComboBoxItem with Value that matches the given value.

C#
public int FindItemIndexByValue(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:

int

Returns the index of the first RadComboBoxItem with Value that matches the given value.

C#
public int FindItemIndexByValue(string value)
Parameters:valuestring

The value to search for.

Returns:

int

Determines the index of the specified RadComboBoxItem object in the collection.

C#
public virtual int IndexOf(RadComboBoxItem item)
Parameters:itemRadComboBoxItem

The RadComboBoxItem to locate.

Returns:

int

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

Inserts the specified RadComboBoxItem object in the current RadComboBoxItemCollection at the specified index location.

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

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

itemRadComboBoxItem

The RadComboBoxItem to insert.

Inserts an item to the collection at the specified index.

C#
public virtual void Insert(int index, string text)
Parameters:indexint

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

textstring

The text of the new item.

Removes the specified RadComboBoxItem object from the current RadComboBoxItemCollection.

C#
public virtual void Remove(int index)
Parameters:indexint

The zero-based index of the index to remove.

Removes the specified RadComboBoxItem object from the current RadComboBoxItemCollection.

C#
public virtual void Remove(RadComboBoxItem item)
Parameters:itemRadComboBoxItem

The RadComboBoxItem object to remove.

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

Overrides: ControlItemCollection.SetOwner(ControlItem)

Sort the items from RadComboBoxItemCollection.

C#
public void Sort()

Sort the items from RadComboBoxItemCollection.

C#
public void Sort(IComparer comparer)
Parameters:comparerIComparer

An object from IComparer interface.