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. Image for the cookie policy date
close icon

Databound Grid DragDrop Problem

I tried to do a drag drop from GDBG1 to GDBG2 on a MDI form. However, the GDBG2''s DragDrop event never get fire. On the other hand, the GDBG2''s DragEnter event does fire properly. What should I do in order to get the DragDrop event working? I already set both grids'' AllowDrop = true. Please advise. Thanks.

4 Replies

AD Administrator Syncfusion Team May 26, 2004 12:12 PM UTC

What version of our libraries are you using? In earlier version, the default windows forms DragDrop support was trumped (meaning the grid would handle the standard events and not forward them onto other listeners) by the grid''s own default OLE D&D support. But this was fixed pretty earlier. Certainly 1.6.1.8 and later should not have this problem. Here is a sample that drags & drops between grid''s on an MDI child forms, and the DragDrop event is fired for version 2.0.5.1. What are you doing differently? MDI_2511.zip


AD Administrator Syncfusion Team May 26, 2004 06:08 PM UTC

Thanks for the sample, it helps. I am using the latest version of the libraries. I now have an inherited GDBG control which override the OnDragDrop method. This override method does not call the base class OnDragDrop in order to bypass the default drag drop behavior. My problem is that the DragDrop event never get fire in the Form. What should I do in my override OnDragDrop method in order to fire the DragDrop event back to the Form. Thanks in advance. >What version of our libraries are you using? > >In earlier version, the default windows forms DragDrop support was trumped (meaning the grid would handle the standard events and not forward them onto other listeners) by the grid''s own default OLE D&D support. > >But this was fixed pretty earlier. Certainly 1.6.1.8 and later should not have this problem. > >Here is a sample that drags & drops between grid''s on an MDI child forms, and the DragDrop event is fired for version 2.0.5.1. What are you doing differently? > >MDI_2511.zip > >


AD Administrator Syncfusion Team May 26, 2004 07:01 PM UTC

The DragDrop event can only be raised in the baseclass. So, you not calling the baseclass is why the event is not raised. One thing you could do is to add your own event, and then raised that event in your override. Then the form would subscribe to your event, and not the baseclass event that does not get raised.
public class MyGridDataBoundGrid : GridDataBoundGrid
{
	public event DragEventHandler MyDragDrop;
	
	protected override void OnDragDrop(DragEventArgs drgevent)
	{
		// TODO:  Add MyGridDataBoundGrid.OnDragDrop implementation
		//base.OnDragDrop (drgevent);
		if(this.MyDragDrop != null)
			this.MyDragDrop(this, drgevent);
	}
}
If you are programmoing in VB, you might be able to avoid this extra by trying RaiseEvent to see if that will work in your override. (I did not try to do it...)


AD Administrator Syncfusion Team May 26, 2004 11:05 PM UTC

Thanks again for your excellent support! >The DragDrop event can only be raised in the baseclass. So, you not calling the baseclass is why the event is not raised. > >One thing you could do is to add your own event, and then raised that event in your override. Then the form would subscribe to your event, and not the baseclass event that does not get raised. >
>public class MyGridDataBoundGrid : GridDataBoundGrid
>{
>	public event DragEventHandler MyDragDrop;
>	
>	protected override void OnDragDrop(DragEventArgs drgevent)
>	{
>		// TODO:  Add MyGridDataBoundGrid.OnDragDrop implementation
>		//base.OnDragDrop (drgevent);
>		if(this.MyDragDrop != null)
>			this.MyDragDrop(this, drgevent);
>	}
>}
>
> >If you are programmoing in VB, you might be able to avoid this extra by trying RaiseEvent to see if that will work in your override. (I did not try to do it...)

Loader.
Live Chat Icon For mobile
Up arrow icon