Copy with IsVisible = False

2 posts, 1 answers
  1. GJ
    GJ avatar
    5 posts
    Member since:
    Aug 2015

    Posted 03 Mar 2017 Link to this post

    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

  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    2951 posts

    Posted 06 Mar 2017 Link to this post

    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.
Back to Top