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

RadDropDownList Object

The following table lists the methods of the client-side RadDropDownList object:

NameParametersReturn TypeDescription
get_itemsnoneTelerik.Web.UI.DropDownListItemCollectionGets a collection with all items.
getItemNumberTelerik.Web.UI.DropDownListItemGets the item from the Items collection residing at the index specified by the parameter. See Example 1.
findItemByTextStringTelerik.Web.UI.DropDownListItemGets the first item with the given text. See Example 1.
findItemByValueStringTelerik.Web.UI.DropDownListItemGets the first item with the given value. See Example 1.
get_selectedItemnoneTelerik.Web.UI.DropDownListItemGets the selected item. See Example 3.
repaintnonenoneRefreshes the RadDropDownList UI.
set_enabledBooleannoneEnables RadDropDownList.
get_childListElementnoneHTMLElementGets the UL element of the RadDropDownList.
get_dropDownElementnoneHTMLElementGets the root DOM element of the RadDropDownList.
get_textElementnoneHTMLElementGets the DOM element of the RadDropDownList where the text of the currently selected item is shown.
openDropDownnonenoneOpens the DropDown.
closeDropDownnonenoneCloses the DropDown.
toggleDropDownnonenoneToggles the DropDown state between opened and closed.
get_clientTemplatenoneStringReturns the value of the RadDropDownList's ClientItemTemplate property.
set_clientTemplateStringnoneSets the value of the RadDropDownList's ClientItemTemplate property.
get_emptySelectionMessagenoneStringReturns the value of the RadDropDownList's EmptySelectionMessage property.
set_emptySelectionMessageStringnoneSets the value of the RadDropDownList's EmptySelectionMessage property.
trackChangesnonenoneStarts tracking changes made to RadDropDownList that will be preserved over postbacks. See Example 4.
commitChangesnonenoneWrites the changes to RadDropDownList that were made since a previous call to trackChanges, so that they are preserved over postbacks. Client-side changes are available on the server after postback. You can use the ClientChanges property to access them. See Example 4.
saveClientStatenonenoneSaves the client state to the client state hidden field.
get_webServiceSettingsnoneTelerik.Web.UI.WebServiceSettingsGets the Web service settings of the RadDropDownList.
set_webServiceSettingsTelerik.Web.UI.WebServiceSettingsnoneSets the Web service settings of the RadDropDownList.
get_expandAnimationnoneTelerik.Web.UI.AnimationSettingsGets the expand animation settings of the RadDropDownList.
set_expandAnimationTelerik.Web.UI.AnimationSettingsnoneSets the expand animation settings of the RadDropDownList.
get_collapseAnimationnoneTelerik.Web.UI.AnimationSettingsGets the collapse animation settings of the RadDropDownList.
set_collapseAnimationTelerik.Web.UI.AnimationSettingsnoneGets the collapse animation settings of the RadDropDownList.
get_enableScreenBoundaryDetectionnoneBooleanGets the value of the EnableScreenBoundaryDetection property of the RadDropDownList.
set_enableScreenBoundaryDetectionBooleannoneSets the value of the EnableScreenBoundaryDetection property of the RadDropDownList.
get_enableDirectionDetectionnoneBooleanGets the value of the EnableDirectionDetection property of the RadDropDownList.
set_enableDirectionDetectionBooleannoneSets the value of the EnableDirectionDetection property of the RadDropDownList.
get_expandDirectionnoneTelerik.Web.UI.DropDownListExpandDirectionGets the expand direction of the dropdown. DropDownListExpandDirection.Up = 0; DropDownListExpandDirection.Down = 1.
set_expandDirectionTelerik.Web.UI.DropDownListExpandDirectionnoneSets the expand direction of the dropdown. DropDownListExpandDirection.Up = 0; DropDownListExpandDirection.Down = 1.
get_rippleZonesConfigurationnoneArrayReturns an array with two objects with "element" and "rippleConfigurations" properties. The first object has the configuration of the DropDownList element and the second object - for the dropdown element of the DropDownList.

Example 1: Find an item by index, text, value.

JavaScript
var dropdownlist = $find("<%= RadDropDownList1.ClientID %>");
var itemByIndex = dropdownlist.getItem(0);
var itemByText = dropdownlist.findItemByText("Item 1");
var itemByValue = dropdownlist.findItemByValue("1");

Example 2: Select an item.

JavaScript
var dropdownlist = $find("<%= RadDropDownList1.ClientID %>");
var itemByIndex = dropdownlist.getItem(0);
itemByIndex.select();

Example 3: Clear selection.

JavaScript
var dropdownlist = $find("<%= RadDropDownList1.ClientID %>");
var selectedItem = dropdownlist.get_selectedItem();
if(selectedItem){
    selectedItem.unselect();
}

Example 4: Add a new item and persist it after a postback.

JavaScript
		
function AddNewItem() {
    var dropdownlist = $find("<%= RadDropDownList1.ClientID %>");
    var dropdownlistItem = new Telerik.Web.UI.DropDownListItem();
    dropdownlistItem.set_text("item");
    dropdownlist.trackChanges();
    dropdownlist.get_items().add(dropdownlistItem);
    dropdownlistItem.select();
    dropdownlist.commitChanges();
}
	
Not finding the help you need?
Contact Support