This is a migrated thread and some comments may be shown as answers.

Copy with IsVisible = False

1 Answer 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
GJ
Top achievements
Rank 1
GJ asked on 03 Mar 2017, 08:39 AM

Hello,

When I try to copy a row with a hidden column the clipboard only get visible columns, i need the value of hidden column because it get the ID of the record. 

How can i get this value from clipboard?

Thank you

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 06 Mar 2017, 01:57 PM
Hi Jorge,

Thank you for writing.

This can be achieved by manually setting the data:
private void RadGridView1_Copying(object sender, Telerik.WinControls.UI.GridViewClipboardEventArgs e)
{
    e.Cancel = true;
    StringBuilder content = new StringBuilder();
    foreach (var row in radGridView1.SelectedRows)
    {
 
        foreach (GridViewCellInfo cell in row.Cells)
        {
            if (cell.Value != null)
            {
 
                content.Append(cell.Value.ToString() + " ");
 
            }
 
        }
        content.AppendLine();
    }
 
    e.DataObject.SetData(DataFormats.Text, false, content.ToString());
}

I hope this will be useful.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
GJ
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or