[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Grid View
  [Collapse]Tree List
   [Expand]Product Information
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Data Editing
    [Expand]Data Shaping and Manipulation
     Drag and Drop
    [Expand]Focus and Navigation
     Appearance Customization
     Save and Restore Client Layout
   [Expand]Visual Elements
   [Expand]Member Tables
  [Expand]Card View
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Drag and Drop

The ASPxTreeList supports drag and drop. You can allow end-users to move nodes via drag and drop either within an ASPxTreeList or between the ASPxTreeList and external controls. This can significantly increase the usability of your web application.


If the ASPxTreeList is in edit mode, nodes are not allowed to be dragged.

Expanded End-User Drag-And-Drop

To enable drag and drop operations, turn on the TreeListSettingsEditing.AllowNodeDragDrop option. Once enabled, an end-user can drag a node and move it to the required position. The yellow arrow indicates a node to whose child collection the dragged node will be appended.

To move a node to the root, drag it to the header panel:

To cancel the drag and drop operation, press ESC.

Expanded Controlling Drag-And-Drop Operations

The ASPxTreeList provides two client-side and one server-side events that enable you to processes drag-and-drop operations.

  • The ASPxClientTreeList.StartDragNode event is raised before a user starts dragging a node. It enables you to specify target elements for the dragged node. When the dragged node hovers over a target, the arrow is displayed.
  • The ASPxClientTreeList.EndDragNode event is raised after a node drag and drop operation is completed.

    Both events allow you to cancel the operation by setting the event parameter's cancel property to true.

  • Finally, the server-side ASPxTreeList.ProcessDragNode event is raised and allows you to perform server-side processing, if required, or cancel the operation.

Expanded Example

This example demonstrates how to implement node dragging outside the ASPxTreeList. The ASPxClientTreeList.StartDragNode client event is handled to add the cart image to the list of target elements, so that an end-user can drag nodes to the cart. If a node has been dropped to the cart, the cart image changes (in the ASPxClientTreeList.EndDragNode client event handler) and the node is painted red (using the server ASPxTreeList.HtmlRowPrepared event).

The image below shows the result:

Expanded Moving Nodes In Code

To move nodes use the ASPxTreeList.MoveNode or ASPxClientTreeList.MoveNode method. The only requirement is the ASPxTreeList's ASPxTreeList.ParentFieldName property must be specified. Otherwise, calling the MoveTo method throws an exception.

Calling the MoveNode method raises the ASPxTreeList.ProcessDragNode event. This event allows you to cancel the drag and drop operation, or to manually process the operation. For an example, see How to: Perform Drag And Drop in Virtual Mode.

Is this topic helpful?​​​​​​​