RadListBox for ASP.NET AJAX

RadControls for ASP.NET AJAX

RadListBox supports a number of client-side events that let you customize the behavior of the listbox:

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.

CopyASPX
<telerik:radlistbox id="RadListBox1" allowdelete="true" onclientdeleted="onClientDeletedHandler"
    runat="server"></telerik:radlistbox>
CopyJavaScript
function onClientDeletedHandler(sender, e) {
    alert("Successfully deleted: " + e.get_item().get_text());
}

There is a shorter way to handle a client-side event:

CopyASPX
<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:

CopyC#
     

RadListBox1.OnClientDeleted = "onClientDeletedHandler";

See Also