New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

RadComboBoxItem Object

The RadComboBoxItem object is returned by the getItem method of the RadComboBoxItemCollection object. It is also exposed by the eventArgs of many client-side events (eventArgs.get_item()). The following table lists the most important methods:

NameParametersReturn TypeDescription
highlightnonenoneHighlights an item.
unHighlightnonenoneUnhighlights an item.
selectnonenoneSelects an item.
disablenonenoneDisables an item.
enablenonenoneEnables an item.
get_comboBoxnoneobjectGets the parent RadComboBox control. See Example 1.
get_highlightednonebooleanTrue if the item is highlighted. To highlight an item use the highlight method.
get_indexnoneintGets the index of an item in the Items collection.
get_enablednonebooleanTrue if the item is enabled. To enable an item use the enable method.
get_textnonestringGets the text of an item.
set_textstringnoneSets text of an item.
get_valuenonestringGets the value of an item.
set_valuestringnoneSets the value of an item.
get_checkednonebooleanTrue if an item is checked, False if not.
set_checkedbooleannoneChecks or unchecks an item.
get_isSeparatornonebooleanTrue if an item is separator (IsSeparator="True").
get_attributesnonecollectionReturns a collection of custom attributes defined for an item.
getAttributeStringStringReturns a specific attribute from the Attributes collection.
setAttributeString, StringnoneAdds an attribute to the Attributes collection. See Example 2.
get_visiblenonebooleanTrue if the item is visible.
set_visiblebooleannoneSets the visibility of an item.
shownonenoneMakes the item visible, same as set_visible(true).
hidenonenoneMakes the item invisible, same as set_visible(false).
get_imageUrlnonestringReturns the full path to an item's image.
set_imageUrlstringnoneSets the ImageUrl property of an item.
get_disabledImageUrlnonestringReturns the full path to the image of a disabled item.
set_disabledImageUrlstringnoneSets the DisabledImageUrl property of an item.
findControlstringobjectReturns the object which is in the item template.
get_elementnoneHTML elementReturns the <LI> HTML element of an item.

Example 1: Gets the parent RadComboBox control.

ASPNET

<script language="javascript" type="text/javascript">
    function OnClientSelectedIndexChangingHandler(sender, eventArgs) {
        var item = eventArgs.get_item();
        var combo = item.get_comboBox();
    }
</script>

<telerik:radcombobox id="RadComboBox1" 
    runat="server" 
    onclientselectedindexchanging="OnClientSelectedIndexChangingHandler">
</telerik:radcombobox>

Example 2: Get an item's attribute and set a value to it.

JavaScript

var combo = $find("<%= RadComboBox2.ClientID %>");
var item = combo.findItemByText("Apples");

//get a custom attribute called "Color"
item.get_attributes().getAttribute("Color");

//set new custom attribute called "Size"
item.get_attributes().setAttribute("Size", "2");
	

See Also

In this article
See Also
Not finding the help you need?
Contact Support