Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
530
BeforeRowUpdate fired twice
posted

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;