Events Overview
RadListBox supports a number of client-side events that let you customize the behavior of the listbox:
OnClientLoad client-side event occurs after RadListBox has been fully initialized on the client-side.
OnClientDeleting occurs before the items are deleted. This event can be canceled.
OnClientDeleted occurs after the items are deleted.
OnClientDragStart occurs as the drag operation occurs. This event can be canceled.
OnClientDragging occurs while an item is being dragged. This event can be canceled.
OnClientDropping occurs before the items are dropped. The event can be canceled.
OnClientDropped occurs after the item/items are dropped.
OnClientItemDoubleClicking occurs when the user double clicks the item using the mouse. The event can be canceled.
OnClientItemDoubleClicked occurs after the user double clicks the item using the mouse.
OnClientItemChecking occurs when the user selects a checkbox using mouse or keyboard. The event can be canceled.
OnClientItemChecked occurs after the item has been checked.
OnClientCheckAllChecking occurs when the user clicks on the CheckAll item. The event can be canceled.
OnClientCheckAllChecked occurs after user clicks on the CheckAll item.
OnClientItemsRequesting occurs before the items are added to the listbox' Items collection.
OnClientItemsRequested occurs after the load-on-demand mechanism has added new items to the listbox.
OnClientItemsRequestFailed occurs when an error has occurred while loading elements using the load-on-demand mechanism.
OnClientReordering client-side event occurs when the item or items are about to be reordered. This event can be canceled.
OnClientReordered client-side event occurs after the item or items have been reordered.
OnClientTransferring client-side event occurs when the selected item is about to be transferred to the destination RadListBox. This event can be canceled.
OnClientTransferred client-side event occurs after the selected item has been transferred to the destination RadListBox.
OnClientSelectedIndexChanging client-side event occurs when the selected item is about to be changed. This event can be canceled.
OnClientSelectedIndexChanged occurs after the selected item has been changed.
OnClientTemplateDataBound occurs after the client template is bound and the binding expression are evaluated.
OnClientMouseOver client-side event occurs when the mouse cursor passes over an item.
OnClientMouseOut client-side event occurs just before the mouse passes out of an item.
OnClientContextMenu client-side event occurs when a user right clicks over a listbox item
To subscribe to a client event just set the appropriate property to the name of the javascript function that will handle the event. The function always receives two parameters - a sender (RadListBox firing the event) and event arguments having different methods.
<telerik:radlistbox id="RadListBox1" allowdelete="true" onclientdeleted="onClientDeletedHandler" runat="server"></telerik:radlistbox>
function onClientDeletedHandler(sender, e) {
alert("Successfully deleted: " + e.get_item().get_text());
}
There is a shorter way to handle a client-side event:
<telerik:radlistbox id="RadListBox2" allowdelete="true" onclientdeleted="(function(sender, e){ alert('Successfully deleted: ' + e.get_item().get_text()); })" runat="server">
</telerik:radlistbox>
Similarly, you can set the property in code behind:
RadListBox1.OnClientDeleted = "onClientDeletedHandler";
RadListBox1.OnClientDeleted = "onClientDeletedHandler"