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

Drag/Drop rows between DBDGs

Thread ID:





7906 Oct 14,2003 01:56 PM UTC Oct 14,2003 04:51 PM UTC WinForms 3
Tags: GridControl
Doug Lind
Asked On October 14, 2003 01:56 PM UTC

Can anyone point me to an example of how to drag and drops rows between data bound grids? Thanks, Doug Lind

Administrator [Syncfusion]
Replied On October 14, 2003 03:51 PM UTC

This is more or less supported out of the box. Make sure you set the AllowDrop property on both grids. this.gridDataBoundGrid1.AllowDrop = true; this.gridDataBoundGrid2.AllowDrop = true; Then you should be able to click a row header to select a row. Then move the cursor to the edge of the selection to see the D&D cursor. Once you have the D&D cursor, mouse down and drag the selection to the other grid. (This will do a move, so you may want to hold the ctl key as you drop to do a copy...)

Doug Lind
Replied On October 14, 2003 04:22 PM UTC

Thanks for the reply Clay. I'm not sure the out of the box DnD will work. My DBDGs reside on different forms and have different formats. This is actually a copy operation. My plan was to intercept the destination grid's DragDrop event to perform the neccessary data massaging and insert the new records. Unfortunately, I can't get the event to trigger on the grid. It works fine if I try dragging it to a plain textbox, so the DnD setup seems to be correct. Any suggestions on how to grab the DragDrop event for the GDBG? For testing purposes, the destination grid is not bound or formatted, and I'm just passing a text string to verify connections. Does that make a difference? Also, the DragOver event triggers and processes the DragDropEffects correctly, but the cursor is never modified, as in a standard DnD operation. Seems like something is overriding it. Thanks, Doug

Administrator [Syncfusion]
Replied On October 14, 2003 04:51 PM UTC

You might be able to get your currentcode to work just by turning off the grid's default support which may be inerfereing with what you are trying to do. To turn it off, in the designer, uncheck the OleDataTarget flag under the ControllerOptions property. Essential Grid has an extensible OLE D&D architecture that you can tie into if you want. You would not have to handle things like DragEnter, DrawOver, etc. Instead, you create your own dataobject that implements IGridDataObjectConsumer, and register this object with RegisterDataObjectConsumer that tells the grid to check for your dataobject in its OLE D&D. Attached is a VB project that shows how you can create a dataobject to drag a row for a Windows Forms DataGrid to a GridControl. There are only 4 items you need to implement for the interface as you can see from the sample. Here is another sample with a class added that implements IGridDataObjectConsumer to provide drop support for a treenode. This implemetation just automaticlly drops the node text as a new row to a GriddataBoundGrid.The steps are: 1) add the TreeNodeDataObjectConsumer class whcih implements IGridDataObjectConsumer to support dropping of TreeNode objects. 2) add a Form_Load to register a TreeNodeDataObjectConsumer object as a dataconsumer that the grid will poll as part of its D&D support.


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