New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
OnClientDeleting
The OnClientDeleting Client-side event occurs when the item or items are about to be deleted. This event can be cancelled.
The event handler receives two parameters:
-
The instance of the listbox firing the event
-
An event arguments parameter containing the following methods:
-
get_items() - returns an array of the items selected for deletion
-
get_item() - returns the item that is about to be deleted.
-
set_cancel() - lets you cancel the event and prevent items from deleting.
-
get_domEvent() - returns the DOM event object
The example below shows how to delete an item after the user clicks OK in the confirmation dialog:
JavaScript
function onClientDeletingHandler(sender, e) {
if (!confirm("Are you sure?")){
e.set_cancel(true);
}