New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
OnClientDragStart
The OnClientDragStart client-side event occurs each time the user begins to drag an item. 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_sourceItem() - returns the first selected item that is dragged
-
get_sourceItems() -returns an array of the selected items that are dragged
-
set_cancel() - lets you cancel the event and prevent the dragging.
-
get_domEvent() - returns the DOM event object
-
get_htmlElement() - returns the DOM html element which the item is dropped onto.
The following example shows how to cancel the event if the number of the selected/dragged items is greater than 3:
JavaScript
function onClientDragStartHandler(sender, e) {
if (e.get_sourceItems().length > 3) {
e.set_cancel(true);
}
}