Unplanned
Last Updated: 02 Sep 2016 12:28 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 30 Aug 2016 06:53
Category: GridView
Type: Bug Report
0
FIX. RadGridView - the RowsChanged event with Action=ItemChanged is fired before with Action=Add when adding a row
To reproduce:

public Form1()
{
    InitializeComponent();
    this.radGridView1.Columns.Add("Name");
    this.radGridView1.Columns.Add("ID");

    this.radGridView1.RowsChanged += radGridView1_RowsChanged;
}

private void radGridView1_RowsChanged(object sender, GridViewCollectionChangedEventArgs e)
{
    Console.WriteLine(e.Action);
    if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)
    {
        GridViewRowInfo row = e.NewItems[0] as GridViewRowInfo;
        row.Cells["ID"].Value = this.radGridView1.Rows.Count;
    }
}

private void radButton1_Click(object sender, EventArgs e)
{
    this.radGridView1.Rows.Add("Item" + this.radGridView1.Rows.Count);
}

Note: the first firing of the RowsChanged event used to be with Action=Add.
0 comments