Declined
Last Updated: 17 May 2017 05:15 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 15 Feb 2017 11:32
Category: GridView
Type: Bug Report
1
FIX. RadGridView - keeps adding new rows when you click on any cell and the UserAddingRow event is canceled
To reproduce: please refer to the attached sample project and gif file illustrating the behavior.

Workaround: in order to cancel adding of the new row, you can call the MasterView.TableAddNewRow.CancelAddNewRow method:

private void radGridView1_UserAddingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e)
{
    e.Cancel = true;
    this.radGridView1.MasterView.TableAddNewRow.CancelAddNewRow(); 
    int index = this.radGridView1.Rows.Count;
    this.radGridView1.Rows.Add(index, "Row" + index);
}
1 comment
ADMIN
Stefan
Posted on: 16 May 2017 14:58
We have revised this case and this is expected behavior, caused by the code in the app, not the control. When you add some data in the new row and click outside of the new row, the UserAddingRow gets fired to tell you that the user is trying to add new row to the grid. At this point, the event is canceled and the code adds new row manually. However, since the new row remains current, consecutive clicks outside of it will attempt to add it again, hence the rows being added. To handle this just make sure you cancel what's in the new row using the CancelAddNewRow method, as shown above.