I have a RadGrid control with a NestedViewTemplate that contains two other RadGrid controls. I want to be able to perform drag and drop within each grid. The records will not be able to be dropped onto another grid, only within the same grid. Drag and drop in the parent grid works fine. When I try to perform drag and drop within one of the two grids in the NestedViewTemplate, I am unable to get a reference to the owning grid of the dragged items using e.DraggedItems[0].OwnerTableView or other various methods. They all return references to the main grid, the one that contains the two nested grids. How can I get a reference to the grid from which the dragged item came? Thanks.
6 Answers, 1 is accepted
0
Hello Dave,
Please make sure you disable AllowRowsDragDrop property of the main RadGrid in the ClientSettings, and also make sure you define your RowDrop event handler of the inner RadGrids in the ItemDataBound event:
In the above example, we check for a GridNestedViewItem in the ItemDataBound event of the parent, and then find the two inner RadGrids and assign their RowDrop event handler.
All the best,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Please make sure you disable AllowRowsDragDrop property of the main RadGrid in the ClientSettings, and also make sure you define your RowDrop event handler of the inner RadGrids in the ItemDataBound event:
void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridNestedViewItem) |
{ |
GridNestedViewItem item = (GridNestedViewItem)e.Item; |
(item.FindControl("RadGridChild1") as RadGrid).RowDrop += new GridDragDropEventHandler(RadGridChild1_RowDrop); |
(item.FindControl("RadGridChild2") as RadGrid).RowDrop += new GridDragDropEventHandler(RadGridChild2_RowDrop); |
} |
} |
In the above example, we check for a GridNestedViewItem in the ItemDataBound event of the parent, and then find the two inner RadGrids and assign their RowDrop event handler.
All the best,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Dave
Top achievements
Rank 1
answered on 30 Jun 2008, 03:12 PM
Unfortunately, I can't disable the AllowRowsDragDrop property of the main grid. I need to be able to do drag and drop with all three grids. Is there a way to allow drag and drop for all grids?
Thanks,
Dave
Thanks,
Dave
0
Hi Dave,
To allow row drop for all RadGrids, you will need to enable their respective properties after each RadGrid you define. There is no global setting for inner RadGrids. On the other hand it seems we will need to look deeper into the matter with the rowdrop event. Please consider opening a regular support ticket where you can provide us a sample runnable project. Once we can reproduce the misbehavior, we will be able to further advise you.
Looking forward to your reply.
Greetings,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
To allow row drop for all RadGrids, you will need to enable their respective properties after each RadGrid you define. There is no global setting for inner RadGrids. On the other hand it seems we will need to look deeper into the matter with the rowdrop event. Please consider opening a regular support ticket where you can provide us a sample runnable project. Once we can reproduce the misbehavior, we will be able to further advise you.
Looking forward to your reply.
Greetings,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Dave
Top achievements
Rank 1
answered on 01 Jul 2008, 02:50 PM
I have enabled the drag and drop functionality in each grid. It just doesn't seem to know the originating grid when I start the drag/drop from a grid in the nested view template. It seems to know the destination grid just fine. I will open a support ticket and attach a working solution.
Thanks,
Dave
Thanks,
Dave
0
Jonathan Puddle
Top achievements
Rank 1
answered on 26 Apr 2010, 11:17 AM
We would like to enable drag and drop for the nested child grids, but disable it for the parent grid. Would this example work for us also?
0
Hi Jonathan,
You should be fine disabling RowDrop for the parent grid and enabling it for the child grids. Let me know if any problems with that occur.
Best wishes,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You should be fine disabling RowDrop for the parent grid and enabling it for the child grids. Let me know if any problems with that occur.
Best wishes,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.