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

RadListBox Object

The following table lists the most important methods of the client-side RadListBox object:

  

NameParametersReturn TypeDescription
trackChangesnonenoneStarts tracking changes made to the listbox that will be preserved over post-backs.
commitChangesnonenoneWrites the changes to the listbox that were made since a previous call to trackChanges, so that they are preserved over post-backs. (see Example 1)
findItemByTextstringRadListBoxItemReturns the first RadListBoxItem object whose Text property equals to the passed parameter.
findItemByValuestringRadListBoxItemReturns the first RadListBoxItem object whose Value property equals to the passed parameter.
findItemByAttributestring (attribute name), string (attribute value)RadListBoxItemGets the first instance of a RadListBoxItem with the specified attribute / value pair.
clearSelectionnonenoneClears the selection. There will be no selected items.
clearSelectionExceptint or RadListBoxItemnoneClears the current selection except the specified Index or Item.
getItemintRadListBoxItemGets the item from the Items collection residing at the index specified by the parameter.
get_itemsnoneRadListBoxItemCollectionGets a collection with all items
get_selectedItemnoneRadListBoxItemGets the selected item (or the first selected item if the SelectionMode="Multiple" ).
get_selectedItemsnonearrayGets an array of the selected RadListBoxItem objects
get_selectedIndexnoneintGets the index of the selected item
get_checkedItemsnonearrayGets an array of the checked RadListBoxItem objects
reorderItemRadListBoxItem and IndexnoneMoves the specified item to the specified index
transferToDestinationRadListBoxItemnoneTransfers the specified item to the listbox specified by the TransferToID property
transferFromDestinationRadListBoxItemnoneTransfers the specified item from the listbox specified by the TransferToID property
transferItemRadListBoxItem, SourceRadListBox, DestinationRadListBoxnoneTransfers the specified item from the source listbox to the destination listbox
get_elementnoneHTML elementGets the outer DIV of the RadListBox
get_childListElementnoneHTML elementGets the UL element of the RadListBox
get_idnonestringGets the ClientID of the RadListBox
deleteItemRadListBoxItemnoneDeletes the item passed as an argument
insertItemsArray of RadListboxItemsnoneBulk inserts an array of RadListbox items to RadListBox
set_visiblebooleannoneSets the listview as visible or not on the client

Example 1: Demonstrates the usage of the commitChanges method

JavaScript
function AddNewItem() {
	var listbox = $find("<%= RadListBox1.ClientID %>");
	var item = new Telerik.Web.UI.RadListBoxItem();
	item.set_text("item");
	listbox.trackChanges();
	listbox.get_items().add(item);
	item.select(); 
	listbox.commitChanges();
}	

See Also

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