We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Rearrange the grid using DragDrop

Thread ID:





37566 Nov 25,2005 01:24 AM UTC Nov 28,2005 09:09 AM UTC WinForms 3
Tags: GridControl
Asked On November 25, 2005 01:24 AM UTC

Hi, I''m using the gridcontrol in I want to rearrange the grid using DragDrop. However, since the grid data in front of drop will disappear if DragDrop Event is used, it cannot rearrange. Isn''t there any Event which memorizes only the cell position to which DragDrop came, without updating GridData? Thanks

Administrator [Syncfusion]
Replied On November 25, 2005 02:50 AM UTC

So you want to start a D&D in a grid, but then not let the grid complete the drop? If so, you can derive the grid and override OnDargDrop and not call the base class. To see where the drag started you can handle the QueryOleDataSourceData event.
public class MyGridControl : GridControl
	public MyGridControl()
		this.Model.QueryOleDataSourceData += new GridQueryOleDataSourceDataEventHandler(Model_QueryOleDataSourceData);
	protected override void OnDragDrop(DragEventArgs drgevent)
		//base.OnDragDrop (drgevent);
	private void Model_QueryOleDataSourceData(object sender, GridQueryOleDataSourceDataEventArgs e)

Replied On November 28, 2005 01:36 AM UTC

Thanks Clay Burch. I want to know not only where the drag started but where it dropped. Thanks,

Administrator [Syncfusion]
Replied On November 28, 2005 09:09 AM UTC

In OnDragDrop, you can use code like:
int row, col;
Point pt = this.PointToClient(Control.MousePosition);
if(this.PointToRowCol(pt, out row, out col))
    //row and col is the drop cell


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon