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

HowTo? CopyPaste on the filtered list

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?

1 Reply

HA haneefm Syncfusion Team 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.
GGC_CopyFilterRecordSample2005.zip

Best regards,
Haneef


Loader.
Live Chat Icon For mobile
Up arrow icon