New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
OnClientReordering
The OnClientReordering client-side event occurs when the item or items are about to be reordered. 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 reordering
-
get_item() - returns the item that is about to be reordered.
-
get_offset() - returns -1 if you are moving the item up and 1 if you are moving the item down.
-
set_cancel() - lets you cancel the event and prevent items from being moved.
-
get_domEvent() - returns the DOM event object
The example below shows how to ask the user before moving the item:
JavaScript
function onClientReorderingHandler(sender, e) {
if (!confirm("Are you sure?")) {
e.set_cancel(true);
}
}