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:

Created:

Updated:

Platform:

Replies:

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

Hi, I''m using the gridcontrol in 3.3.0.0. 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);
		this.Refresh();
		Console.WriteLine("dropped");
			
	}
	private void Model_QueryOleDataSourceData(object sender, GridQueryOleDataSourceDataEventArgs e)
	{
		Console.WriteLine(e.RangeList);
	}
}

DCnagai
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
}

CONFIRMATION

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.

;