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

Extend Drag drop functionality of Grid

1 Answer 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mac P
Top achievements
Rank 1
Mac P asked on 25 Aug 2010, 05:02 PM
Hello,

I want to end drag drop functionality as displayed in demo link
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx

My requirement is that i have another grid that have users list with task number. I just want to drag items from grid container to recipient grid column that have task number. The user list will remain constant but the task number column will keep on increasing on drag and drop from container to recipient.

Inshort it should be combination of above link with one displayed below.
http://demos.telerik.com/aspnet-ajax/listview/examples/itemdragdrop/defaultcs.aspx

Does any body have an example for that or some blog entries?

Regards
Mac

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 31 Aug 2010, 09:10 AM
Hi Mac,

To achieve the desired functionality you could try using the drag drop demo as a basis. However instead of removing the items from the first gird and add items in the second grid, when user performs drag-drop, you could try increasing the task number from the recipient grid's column. You could perform this update on RadGrid.RowDrop event handler. For example:
protected void FirstGrid_RowDrop(object sender, GridDragDropEventArgs e)
{
   if (string.IsNullOrEmpty(e.HtmlElement))
   {
      if (e.DraggedItems[0].OwnerGridID == FirstGrid.ClientID)
      {
         if ((e.DestDataItem == null && SecondGrid.Count == 0) ||
             e.DestDataItem != null && e.DestDataItem.OwnerGridID == SecondGrid.ClientID)
          {
               int destinationItemID = -1;
               if (e.DestDataItem != null)
               {
                   destinationItemID = (int)e.DestDataItem.GetDataKeyValue("ID");
               }
 
               // Update the second RadGrid's GridDataItem with ID equals to destinationItemID
 
               FirstGrid.Rebind();
               SecondGrid.Rebind();
      }
   }
 }
}

Please give it try and if you have some particular issues do not hesitate to contact us again.

Best wishes,
Radoslav
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
Mac P
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or