Drag and Drop Target Grid

2 posts, 0 answers
  1. Claude
    Claude avatar
    39 posts
    Member since:
    Jun 2020

    Posted 29 Dec 2020 Link to this post

    I have it mostly working but am having one issue.  I am trying to get the rowinfo in the target grid where the files are dropped.   Grid 1 has a one to many relationship to grid 2.  I am trying to drag data from grid 2 to a different in row in Grid 1.  I want to get the serialID field of the target row in Grid 1, but have not been able to find a way to get that info. 


    Thank you as always.

  2. Nadya
    Nadya avatar
    508 posts

    Posted 30 Dec 2020 Link to this post

    Hello, Claude,

    It is not clear how exactly you set up the drag-drop functionality, but I suppose that you use the build-in RadGridViewDragDropService which handles the whole drag and drop operation in RadGridView

    The PreviewDragOver event allows you to control on what targets the row being dragged can be dropped on. The PreviewDragDrop event allows you to get a handle on all the aspects of the drag and drop operation, the source (drag) grid, the destination (target) control, as well as the row being dragged. It is possible to get the target row and extract its cells' values while dragging over. In PreviewDragOver you have access to the GridDataRowElement. Through the RowInfo property you can get the GridViewRowInfo:

     private void svc_PreviewDragOver(object sender, RadDragOverEventArgs e)
         if (e.DragInstance is GridDataRowElement)
             e.CanDrop = e.HitTarget is GridDataRowElement ||
                         e.HitTarget is GridTableElement ||
                         e.HitTarget is GridSummaryRowElement;
             GridDataRowElement targetRow = e.HitTarget as GridDataRowElement;
             if (targetRow != null)
               GridViewRowInfo rowInfo = targetRow.RowInfo;
               // TO DO

    I hope this helps. Should you have other questions do not hesitate to contact me.

    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top