This is a migrated thread and some comments may be shown as answers.

RadGrid Drag and Drop

6 Answers 237 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 27 Jun 2008, 03:13 PM
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

Sort by
0
Veli
Telerik team
answered on 30 Jun 2008, 01:01 PM
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:

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
0
Veli
Telerik team
answered on 01 Jul 2008, 09:13 AM
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
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
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
Veli
Telerik team
answered on 28 Apr 2010, 09:36 AM
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.
Tags
Grid
Asked by
Dave
Top achievements
Rank 1
Answers by
Veli
Telerik team
Dave
Top achievements
Rank 1
Jonathan Puddle
Top achievements
Rank 1
Share this question
or