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

Copying rows between grids

Hi, I am trying to copy a set of rows, specified by a start position and number of rows, from one grid control to a second grid control. How can I copy these rows and maintain the style info (column width, row heighth, row data, etc) from one grid to another? Thanks, Gordon

1 Reply

AD Administrator Syncfusion Team November 2, 2004 05:04 PM UTC

If these are non-virtual GridControls, the default copy support should copy all style information for you. But it will not copy things like row height/column widths since this is not part of the GridStyleInfo object. So, to do this special copy/paste, you can handle the grid.ClipboardCopy event. In the handler, create a custom DataObject holding the information you want to persist, and put this object on the clipboard (setting e.Handled if you do not want the grid to continue its default copy support). Then to do the Paste, you would handle the grid.ClipboardPaste event. In your handler, you would retrieve your custom data object from the clipboard, and set the values from it on the grid.

Loader.
Live Chat Icon For mobile
Up arrow icon