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

HowTo? CopyPaste on the filtered list

Thread ID:





69639 Nov 6,2007 12:11 PM UTC Nov 6,2007 06:34 PM UTC WinForms 1
Tags: GridControl
Asked On November 6, 2007 12:11 PM UTC

When I display the filtered data list I would like to copy all the filtered rows by right clicking on the "group" header and selecting "Copy". As of now it copies all the rows irrespective if it's filtered or not, this is because I am calling CopyPaste.Copy() on the ModelTable. Is there a way to CopyPaste.Copy() only the list of items displayed in the view?

haneefm [Syncfusion]
Replied On November 6, 2007 06:34 PM UTC

Hi Liquidnitrogen,

The following is the sample demonstrates the technique to copy the filter grouprecord contents (Cntrl + C) when the user click on the GroupRowHeader and copy it the Clipboard. This data can be pasted to Excel by using (Cntrl + V) command.

This has been achieved by handling the TableControlCellClick event. In the event, the user defiend method is triggered and accordingly contents will be copied. Below is a code snippet.

private void CopyGroupRecords(Element element)
string s = "";

Group group = element.ParentGroup;

foreach (Record rec in group.FilteredRecords)
GridTableDescriptor td = group.ParentTableDescriptor as GridTableDescriptor;
for (int i = 0; i < td.VisibleColumns.Count; ++i)
GridVisibleColumnDescriptor vcd = td.VisibleColumns[i];
if (i != 0)
s += '\t';
s += rec.GetValue(vcd.Name).ToString();
s += Environment.NewLine;

Clipboard.SetDataObject(new DataObject(s), true);

Here is a sample for you reference.

Best regards,


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

This page will automatically be redirected to the 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