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.
Unfortunately, activation email could not send to your email. Please try again.

Rearrange the grid using DragDrop

Thread ID:





37566 Nov 24,2005 08:24 PM Nov 28,2005 04:09 AM Windows Forms 3
Tags: GridControl
Asked On November 24, 2005 08:24 PM

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 24, 2005 09:50 PM

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 27, 2005 08:36 PM

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 04:09 AM

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.

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.