With RadListView you can easily implement Drag & Drop functionality for your data items. To enable Item Drag & Drop in RadListView:
- Set RadListView.ClientSettings.AllowItemsDragDrop="true".
- Add a RadListViewItemDragHandle control to your ItemTemplate / AlternatingItemTemplate.
- Add a CSS marker on a data item container element (.rlvI for ItemTemplate, .rlvA for AlternatingItemTemplate)
On the server, RadListView fires the ItemDrop event you can handle. argument of type RadListViewItemDragDropEventArgs exposes the DraggedItem and DestinationHtmlElement properties. The former references the RadListViewDataItem that has been dropped, while the latter is the client ID of the target HTML element, if any.
On the client-side, RadListView provides 4 client events you can use:
-
OnItemDragStarted - Fired when an item is about to be dragged (cancellable)
-
OnItemDragging - Fired when an item is dragged (on mouse move)
-
OnItemDropping - Fired when an item is dropping on a target element (cancellable)
-
OnItemDropped - Fired after OnItemDropping, before RadListView postbacks
In the example, the client-side OnRowDropping event is used to cancel the postback if the track is dropped outside of the category links.
Drag a track to the right and drop over a category to organize.