Completed
Last Updated: 06 Jan 2017 08:15 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 21 Dec 2016 06:22
Category: GridView
Type: Bug Report
1
FIX. RadGridView - only one cell is copied if there is one selected row although GridViewSelectionMode.FullRowSelect is applied
To reproduce: 

public Form1()
{
    InitializeComponent();
     
    DataTable dt = new DataTable();
    dt.Columns.Add("Id");
    dt.Columns.Add("Name");
    for (int i = 0; i < 1; i++)
    {
        dt.Rows.Add(i, "Item");
    }
    this.radGridView1.DataSource = dt;
    this.radGridView1.SelectionMode = GridViewSelectionMode.FullRowSelect;
    this.radGridView1.ClipboardCopyMode = Telerik.WinControls.UI.GridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
    this.radGridView1.MultiSelect = true; 
}

private void button1_Click(object sender, EventArgs e)
{
    this.radGridView1.SelectAll();
    this.radGridView1.Copy();
}

If you click the button, you will notice that only one cell is copied. However, if you add 2 and more rows, the whole grid content will be copied to the clipboard.

Workaround: use the BeginRowCopy/EndRowCopy methods.

private void button1_Click(object sender, EventArgs e)
{
    this.radGridView1.SelectAll();
    this.radGridView1.MasterTemplate.BeginRowCopy();
    this.radGridView1.Copy();
    this.radGridView1.MasterTemplate.EndRowCopy();
}
0 comments