I am designing a window where I have an ASPxTreeList and an ASPxGridView. Both the tree and the grid are bound to a data source.
I need to drag a node from the tree and drop it on the grid. Then the node text should be displayed at the first column of the grid, before other two columns where I should display predefined text. After drag all the desired nodes to the grid I need to save the data on the grid to its data source. Is it possible? Is there any example available?
The ASPxTreeList is able to drag nodes from itself to other controls. The main idea of dragging nodes between two treelists is implemented in our Code Central example: How to drag and drop nodes between two ASPxTreeList controls.
Unfortunately, we don't have the required example, because we never faced this issue in the past. However, I think that it is possible to drag nodes from the treelist to the grid (not vice versa) via the ASPxClientTreeList.StartDragNode and ASPxClientTreeList.EndDragNode event handlers.
Since I will have to drop the node on the grid, the row must be created at that time. Do you have examples on how to create a row on the gridview programatically?
I am tracking a suggestion to implement drag-and-drop on the gridview. Are there any plans to implement it in the near future? We are redesigning an application and we plan to allow the users to do drag-and-drop in many situations.
It's possible to implement the required functionality using the following approach:
1) Handle the ASPxClientTreeList's StartDragNode event and use the ASPxGridView's main input element as the DraggedNode's target;
2) Handle the ASPxClientTreeList's EndDragNode event and perform the ASPxGridView's callback via the ASPxClientGridView's PerformCallback method. Pass the Node's keyValue as a parameter;
3) Handle the ASPxGridView's CustomCallback event and use the passed Node's keyValue;
4) Remove the data record from the ASPxTreeList's data source using the Node's keyValue;
5) Add a new data row to the ASPxGridView data source using the Node's keyValue.
I've attached a test project, illustrating how to implement the required functionality.
Please take a look at the Examples section of the ASPxClientTreeList.EndDragNode Event topic for more information.
Please also take a look at the following thread, which may be helpful in your scenario:
Drop ASPxGridView Row to another ASPxTreeList Node
Allow Drag and Drop between Grids
Check if Search Engine is able to answer questions faster than I do!
The attached project only illustrates how to drag ASPxTreeList's node to the ASPxGridView control and perform the ASPxGridView's callback. You can perform steps 3-5 manually. Please refer to the Drop ASPxGridView Row to another ASPxTreeList Node report where I've already implemented the required functionality.