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

Cancelling a Drop operation in GDBG

Thread ID:





30896 Jun 27,2005 03:28 AM UTC Jun 27,2005 08:26 AM UTC WinForms 1
Tags: GridControl
Asked On June 27, 2005 03:28 AM UTC

Users sometimes need to move the content from one GDBG cell to another cell, but the application asks the user to confirm this is what he wants to do before carrying out the move. I use the drag-drop features of GDBG by handling the DragDrop event. In the event handler I have the code ask the user if he wants to do the move. Carrying out the move (modifying the underlying data source content) works fine if he says yes. But if he says no, although the underlying data is not moved, the visible cell rendered in the grid appears to have moved. Is there a way to cancel the drop, restoring the grid back to the original appearance before the drag-drop event? I''ve tried setting e.Effect = DragDrofEffects.None in the DragDrop event handler but this seems to have no effect. For performance reasons, I wanted to avoid refreshing the entire grid if possible. Thanks, Van Baker

Administrator [Syncfusion]
Replied On June 27, 2005 08:26 AM UTC

I was able to do this by deriving the GridDataBoundGrid and Effect = None before calling the baseclass in OnDragDrop. Trying to use events, you cannot control the order of the handlers. You need to set the Effect = None before any handlers get a chance to operate on the data. The only way I know to do this is to use a derived grid.
public class MyGridDataBoundGrid : GridDataBoundGrid
	protected override void OnDragDrop(DragEventArgs drgevent)
		if(MessageBox.Show("DropData?", "", MessageBoxButtons.YesNo) == DialogResult.No)
			drgevent.Effect = DragDropEffects.None;
		base.OnDragDrop (drgevent);


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

or the page will be automatically redirected to 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