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

How to copy selected rows including hidden columns from Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl

How to copy selected rows including hidden columns from Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl?


3 Replies

KA Katherine January 30, 2008 06:56 AM UTC

We would like to copy the records to the clipboard.



SR SubhaSheela R Syncfusion Team February 5, 2008 08:41 AM UTC

Hi Katherine,

Thank you for using Syncfusion products.

You can copy the selected row to clip board including hidden cell by getting all the columns in the GridGrouping control using GridColumnDescriptor. After getting all the columns, you can get details of selected record by using GetValue method of Record class. Below is the code snippet:

private void CopySelectedRecords()
{
foreach (SelectedRecord selRec in this.gridGroupingControl1.Table.SelectedRecords)
{
for (int i = 0; i < this.gridGroupingControl1.TableDescriptor.Columns.Count; ++i)
{
GridColumnDescriptor vcd = this.gridGroupingControl1.TableDescriptor.Columns[i];
if (i != 0)
s += '\t';
s += selRec.Record.GetValue(vcd.Name).ToString(); }
s += Environment.NewLine;
}
Clipboard.SetDataObject(new DataObject(s), true);
}
}

Please refer the sample available in the link below and let me know if it helps:

http://websamples.syncfusion.com//samples/ Grouping.Windows/F71413/main.htm

Regards,
Subhasheela R





SU Santosh U October 23, 2009 04:28 PM UTC

Hi Subhasheela,

I have downloaded and used your code It works well. I have modified it for visiblecolumns only.

Now my columns are of type Combo Box so I get the value instead of display text (which I am fine with).

I want to paste this same copied rows in the same grid below (where AddNewRecord is there, How can we achieve this.

Please help,
Thanks,
Santosh U

Loader.
Live Chat Icon For mobile
Up arrow icon