Completed
Last Updated: 07 Dec 2016 07:42 by ADMIN
ADMIN
Dimitar
Created on: 13 Sep 2016 08:42
Category: GridView
Type: Bug Report
1
FIX. RadGridView - not all rows are pasted when pasting in self-reference grid.
To reproduce:
- Select several rows and cells in excel and copy them.
- Paste in the self-reference grid.
- Only the first row is copied. 

Workaround:
private void RadGridView1_Pasting(object sender, GridViewClipboardEventArgs e)
{
    e.Cancel = true;

    List<List<string>> rows = this.GetTextData();
    PrintGridTraverser traverser = new PrintGridTraverser(this.radGridView1.MasterView);

    while (traverser.Current != this.radGridView1.CurrentRow)
    {
        traverser.MoveNext();
    }

    traverser.MovePrevious();
    int rowIndex = 0;
    int colIndex = this.radGridView1.CurrentColumn.Index;

    while (traverser.MoveNext() && rowIndex < rows.Count)
    {
        for (int i = colIndex; i < this.radGridView1.Columns.Count && i - colIndex < rows[rowIndex].Count; i++)
        {
            traverser.Current.Cells[i].Value = rows[rowIndex][i - colIndex];
        }

        rowIndex++;
    }
}

0 comments