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

multiple copy in GDBG

Hey, I was wondering if anyone knows how to be able to select multiple rows and copy that to another databound grid. I have two grids with the same datasource. What I want to be able to do is select multiple rows, hit a copy to button and it will copy the rows I selected from one grid to the exact rows of another grid. A sample would be really helpful. Please let me know if you need clarification. Thanks..

Charlie

5 Replies

AD Administrator Syncfusion Team November 21, 2006 12:16 PM UTC

Hi Charlie,

You can use the Model.CutPaste property to manages the cut/copy/paste functionality in a grid. The following code states how to copy/paste the selected cells in a grid.

//Copy the cells.
GridRangeInfoList rSelectedRange = this.gridDataBoundGrid1.Model.SelectedRanges;
this.gridDataBoundGrid1.Model.CutPaste.CopyRange(rSelectedRange);

//Paste to the cell
this.gridDataBoundGrid1.Model.CutPaste.Paste();

Please refer to the attachment for implementation.
http://www.syncfusion.com/Support/user/uploads/multicopy_c6ed6791.zip

Best Regards,
Haneef


CM Charlie Mao November 25, 2006 12:10 AM UTC

Hey Haneef,

I couldnt get the sample that you provided to work. I tried highlighting a few rows in one grid clock copy and then click on the other grid and hit paste and it didnt do anything. This could be me not using this right. I had one question. Could this sample be modified to hit a "copy to second grid" button and it automatically copies the rows to the other grid.Thanks for your help. I hope you had a great thanksgiving.

Charlie


AD Administrator Syncfusion Team November 27, 2006 09:50 AM UTC

Hi Charlie,

Thanks for the update.

Please try the attached sample and let me know if this helps.
MultipleCopy.zip

Best Regards,
Haneef


CM Charlie Mao November 28, 2006 08:41 PM UTC

Hey Haneef,

The sample you gave me was awesome. It works perfectly. But for some reason, when I try it on my project it doesnt work. I checked the sClipBoardObj variable and it contains the right data and it is detecting my selected rows correctly, but for some reason, it doesnt paste on my other data grid. Is there something that I just missed? My second data grid is on another tab page. Does this matter? I changed the call to CopyToGrid(this.dataGridA,this.dataGridB); which are the names of my datagrid. Thanks for your help. I look forward to your response.

Charlie


AD Administrator Syncfusion Team November 29, 2006 08:44 AM UTC

Hi Charlie,

The attached sample shows you How to copy the data from one grid to another grid using Model.CutPaste property. It also implements the system.Windows.TabControl. Please refer to the attached sample for implementation and let me know if this helps.

Sample : ModifiedMultipleCopy.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon