Last Updated: 17 Apr 2024 14:35 by ADMIN
Dess | Tech Support Engineer, Principal
Created on: 30 Mar 2017 05:33
Category: GridView
Type: Bug Report
FIX. RadGridView - CellValidating event is fired twice when the validation fails and the user clicks a RadButton
To reproduce: please refer to the attached sample project. Note that the CellValidating event is fired twice even without showing a RadMessageBox. With an MS Button the problem is not reproducible.

Workaround: use the RadGridView.ValueChanging event to perform validation while the user is typing in the active editor:
 private void radGridView1_ValueChanging(object sender, Telerik.WinControls.UI.ValueChangingEventArgs e)
   if (((string)e.NewValue) != "x")
         RadMessageBox.Show("Only 'x' allowed!");
         e.Cancel = true;

1 comment
Posted on: 25 Jun 2018 13:03
This is normal because user cancel the CellValidating and at the same time adds new rows.  This causes the CellValidating event to be fired twice. If we change this behavior (which is correct) it will break other cases.