RadPageView DragDrop - copy Row from RadPageView to System.Windows.Forms.DataGridView

2 Answers 37 Views
GridView
Radek
Top achievements
Rank 2
Bronze
Iron
Iron
Radek asked on 12 Dec 2025, 12:21 PM

Hello,

I’m working with some older forms that use System.Windows.Forms.DataGridView. The form is quite complex, so converting it to Telerik isn’t straightforward.

I’d like to copy a row from RadPageView. Could you please provide a sample code snippet showing how to achieve this?

Thank you!

Radek

2 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 16 Dec 2025, 02:58 PM

Hi Radek,

I appreciate your interest in our Telerik UI for WinForms controls.

The RadPageView control does not have rows, and I am assuming that you are referencing RadGridView. In that case, you will need to use the Microsoft OLE Drag-Drop methods to drag and drop a row from RadGridView to DataGridView.

In your scenario, let's say that the RadGridView and the MS DataGridView are bound to separate collections of type some custom object(GridItem). We will need to trigger the OLE DragDrop when the user clicks a row. This can be done in the MouseMove event of the RadGridView. Then you can subscribe to the DragDrop and DragEnter events of the DataGridView and handle the incoming data.

private BindingList<GridItem> gridlist;
private BindingList<GridItem> dataGridList;
public Form1()
{
    InitializeComponent();
            
    this.dataGridList = new BindingList<GridItem>();
    this.dataGridView1.DataSource = dataGridList;

    this.radGridView1.MouseMove += RadGridView1_MouseMove;

    this.dataGridView1.AllowDrop = true;
    this.dataGridView1.DragDrop += DataGridView1_DragDrop;         
    this.dataGridView1.DragEnter += DataGridView1_DragEnter;
}

private void DataGridView1_DragEnter(object sender, DragEventArgs e)
{
    e.Effect = DragDropEffects.Move;
}
private void RadGridView1_MouseMove(object sender, MouseEventArgs e)
{
    if (e.Button == MouseButtons.Left && this.radGridView1.CurrentRow != null)
    {
        GridItem draggedRow = this.radGridView1.CurrentRow.DataBoundItem as GridItem;
         
        this.radGridView1.DoDragDrop( draggedRow, DragDropEffects.Move);
    }
}

private void DataGridView1_DragDrop(object sender, DragEventArgs e)
{           
    if (e.Data.GetDataPresent(typeof(GridItem)))
    {
        GridItem draggedItem = e.Data.GetData(typeof(GridItem)) as GridItem;

        dataGridList.Add(draggedItem);
    }
}

Here is the result:

I think that above code will be a good starting point to implement your requirement.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Radek
Top achievements
Rank 2
Bronze
Iron
Iron
answered on 17 Dec 2025, 02:36 PM

Hello,

Of course, I meant RadGridView (sorry for the typo).

Thank you for the sample code—it works fine. However, I have RadGridView and DataGridView in two forms within an MDI parent form.

Could you help me with this?

Thank you

Radek

 

Dinko | Tech Support Engineer
Telerik team
commented on 19 Dec 2025, 03:02 PM

The approach here will be similar. Each of the grids will be in a separate form placed inside the MDI container form. You can move the logic for each grid to its respective Form. I am attaching my test project to demonstrate this better. You can extend the code to works on your side.
Tags
GridView
Asked by
Radek
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Radek
Top achievements
Rank 2
Bronze
Iron
Iron
Share this question
or