This question is locked. New answers and comments are not allowed.
Hi team,
I have implemeted mutiple rows drag and drop between two grids. but now i can drag and drop a row to same grid and it is getting added to that. how can i avoid this?
i tried to find the source and destination in the OnDragInfo event but i can find a property to check whether they are same.
Orion System India
I have implemeted mutiple rows drag and drop between two grids. but now i can drag and drop a row to same grid and it is getting added to that. how can i avoid this?
i tried to find the source and destination in the OnDragInfo event but i can find a property to check whether they are same.
Private Sub OnDragInfo(ByVal sender As Object, ByVal e As DragDropEventArgs)
If e.Options.Status = DragStatus.DragComplete Then
'If e.Options.DestinationCue. = e.Options.SourceCue Then
'End If
Raj
Orion System India
4 Answers, 1 is accepted
0
Hi Raj A R,
I the OnDropQuery method you will most probably have an item or a grid that was the source of the drag and an item or a grid that is the destination of the drop.
If is best to compare the two grids, if they are a source and a destination, you can use:
e.Options.Source == e.Options.Destination
if either the source or the item is a GridViewRow, you can use:
var row = e.Options.Source as RadGridViewRow;
var gridView = row.GridViewDataControl as RadGridView;
Hopefully this will help you with the DragDrop,
Best wishes,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I the OnDropQuery method you will most probably have an item or a grid that was the source of the drag and an item or a grid that is the destination of the drop.
If is best to compare the two grids, if they are a source and a destination, you can use:
e.Options.Source == e.Options.Destination
if either the source or the item is a GridViewRow, you can use:
var row = e.Options.Source as RadGridViewRow;
var gridView = row.GridViewDataControl as RadGridView;
Hopefully this will help you with the DragDrop,
Best wishes,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Raj A R
Top achievements
Rank 1
answered on 30 Nov 2009, 03:23 PM
Hi Miroslav ,
e.Options.Source == e.Options.Destination will working fine for avoiding drag and drop same grid,
But i have another problem the second grid is using HierarchyChildTemplate where i placed another grid.
Now i need to avoid drag and drop inside these child and parent grid.
Raj
Orion systems India,
0
Raj A R
Top achievements
Rank 1
answered on 30 Nov 2009, 07:21 PM
Hi Miroslav ,
"Now i need to avoid drag and drop inside these child and parent grid."
for this issue , I tried the below code to check whether the I drag the row to the parent grid, but it is not working properly I'm getting error some times,
Is there any particular property that i can use to check whether the drag and drop is between parent and child grid?
"Now i need to avoid drag and drop inside these child and parent grid."
for this issue , I tried the below code to check whether the I drag the row to the parent grid, but it is not working properly I'm getting error some times,
Is there any particular property that i can use to check whether the drag and drop is between parent and child grid?
If e.Options.Status = DragStatus.DragComplete Then
' If Not e.Options.Destination.Parent.ToString().Contains("GridViewVirtualizingPanel") Then
'
Raj
Orion systems India,
0
Hi Raj A R,
Can you specify what kind of error are you getting? If it is an exception in our code, could you paste the CallStack as well?
You could check the whether the items source of the particular grid contains the dragged items. Since the DragDrop events are routed, it will pass though both grids. This though may affect the performance because the DragDrop events are called very often and iterating though a lot of items will be slow.
In this case could you use the business items tho check which is the grid? Is there a property on your items or a way for them to know if they are in a particular grid?
You can use the DataContext property of the RadGridViewRow to retrieve the item that it is bound to. Is there a way for you to implement this check?
Kind regards,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Can you specify what kind of error are you getting? If it is an exception in our code, could you paste the CallStack as well?
You could check the whether the items source of the particular grid contains the dragged items. Since the DragDrop events are routed, it will pass though both grids. This though may affect the performance because the DragDrop events are called very often and iterating though a lot of items will be slow.
In this case could you use the business items tho check which is the grid? Is there a property on your items or a way for them to know if they are in a particular grid?
You can use the DataContext property of the RadGridViewRow to retrieve the item that it is bound to. Is there a way for you to implement this check?
Kind regards,
Miroslav
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.