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.
Unfortunately, activation email could not send to your email. Please try again.

HowTo? CopyPaste on the filtered list

Thread ID:

Created:

Updated:

Platform:

Replies:

69639 Nov 6,2007 07:11 AM Nov 6,2007 01:34 PM Windows Forms 1
loading
Tags: GridControl
Liquidnitrogen
Asked On November 6, 2007 07:11 AM

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 01:34 PM

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


CONFIRMATION

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.

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.

;