I would like to know why the BeforeRowUpdate event is fired twice when the e.Cancel property is set to true, any idea? My test grid has a DataTable data source like this:
public DataSet CreateDataStructure() { DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "Col1"; dc.DataType = typeof( string ); dc.AllowDBNull = false; dt.Columns.Add( dc );
dc = new DataColumn(); dc.ColumnName = "Col2"; dc.DataType = typeof( string ); dt.Columns.Add( dc );
ds.Tables.Add( dt ); return ds; }
And the BeforeRowUpdate event handler is:
private void ultraGrid1_BeforeRowUpdate( object sender, CancelableRowEventArgs e ) { // When the next line is commented the BeforeRowUpdate event is fired only once after a cell is edited. if( e.Row.Cells[ "Col1" ].Text != "AA" ) e.Cancel = true; }
Other properties I set are:
ultraGrid1.UpdateMode = Infragistics.Win.UltraWinGrid.UpdateMode.OnCellChangeOrLostFocus; ultraGrid1.RowUpdateCancelAction = Infragistics.Win.UltraWinGrid.RowUpdateCancelAction.RetainDataAndActivation;
By the way, this happens (the event fired twice) when the user click into another control (AfterExitEditMode event is fired then the BeforeRowUpdate event is fired for second time).
Hi,
I tried this out and I get the same results, the event fires twice. This is clearly a bug, so I forward this thread over to Infragistics Developer Support so they can create a case for you and write this up as a bug for developer review.