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

Copy & Paste of hierarchical nature of this data

Clay, I have parent & Child table. If user copies any only row(s) in the parent and paste, I would like to even paste the related child records for the selected row. Child datagrid (datatable) will be hidden........ How can we achieve this? NOTE : ONLY ROW(S) COPY NOT THE CELL COPY Thanks Satish

7 Replies

AD Administrator Syncfusion Team July 29, 2004 04:14 AM

There are two ways that I can think of to try to implement this. Both involve handling the grid.Model.ClipboardCopy event. The first technique would be in the ClipboardCopy handler to loop through the selections, and if a parent row is selected, expand the row and then add the child rows to the grid.Selections collection. Then the default copy should include the child rows. The second techinque is to handle the complete copy process in ClipboardCopy and not relying on the default copy at all. This would give you complete control and probably will be the better appraoch. Again you would loop through all the selected rows, putting the values into a tab delimited string (and delimiting the rows with a Environment.NewLine). When you got to a parent row, you would also loop through its children rows, adding them to the tab delimited string. Then you would put the string in to the Clipboard and setting both e.Handled and e.Result equal true.


SA Satish July 29, 2004 04:39 AM

Clay, Thanks but my problem is this should be executed only if the user is selected the whole row?? how can i check this? Thanks Satish >There are two ways that I can think of to try to implement this. Both involve handling the grid.Model.ClipboardCopy event. > >The first technique would be in the ClipboardCopy handler to loop through the selections, and if a parent row is selected, expand the row and then add the child rows to the grid.Selections collection. Then the default copy should include the child rows. > >The second techinque is to handle the complete copy process in ClipboardCopy and not relying on the default copy at all. This would give you complete control and probably will be the better appraoch. Again you would loop through all the selected rows, putting the values into a tab delimited string (and delimiting the rows with a Environment.NewLine). When you got to a parent row, you would also loop through its children rows, adding them to the tab delimited string. Then you would put the string in to the Clipboard and setting both e.Handled and e.Result equal true. > >


AD Administrator Syncfusion Team July 29, 2004 04:49 AM

You can use grid.Selections.GetSelectedRows to return any selected rows.


SA Satish July 29, 2004 09:04 PM

Clay, I am having problem while pasting becuase of paste content exceeds row''s count. So how to handle this? Do you have any sample? Thanks Satish >You can use grid.Selections.GetSelectedRows to return any selected rows.


AD Administrator Syncfusion Team July 30, 2004 12:04 AM

Here is a little sample that uses grid.Model.ClipboardPaste to make sure the DataTable datasource has enough rows before it lets the grid do its default paste. CopyAppenGDBG_7859.zip


CG Cyril George April 25, 2012 09:30 AM

Pathetic! Wake up Syncfusion... Fix your broken links pleeez!



RB Ragamathulla B Syncfusion Team April 30, 2012 11:56 PM

Hi Cyril,

Thank you for your update.

Due to server maintanance that files are moved from our server so please refer to the following browser sample path which illustrates the same.

{InstalledPath}\Syncfusion\EssentialStudio\{Version}\Windows\Grid.Windows\Samples\2.0\MS Excel-Style Features\Grid Copy-Paste Demo

Let me know if you have any further concerns.

Regards,
Ragamathullah B.


Loader.
Live Chat Icon For mobile
Up arrow icon