I am using this event (BeforeCellUpdate) to validate user grid entry and e.cancel=true if violation found and exiting event. Works Ok in general. However I am having issue with numeric columns and nulls, for example user need abilities to null current cell value and leave it blank. Your grid instead of null applying 0, we would like to know what would be best to do so besides using text type instead of numeric for column. Thanks!
Hi,
I'm not sure I understand the problem. If you want the user to be able to blank out a numeric cell, then you must use a DataSource which can support a null value in a numeric field. If you are using a DataSet/DataTable, then as long as AllowNull is true on the DataColumn, you will be able to set the cell's value to DBNull.Value.
Problem is to do this on entry valudate event (BeforeCellUpdate), if I say e.cancel in code grid will apply 0 in cell, I would like null instead. How would I do this? Thanks!
> if I say e.cancel in code grid will apply 0 in cell
I mean 0 or some other numeric value which I could apply in cell. It doesn't take null, exception will be thrown by typed dataset.
If your DataSet is not accepting the value you are assigning, then that probably doesn't have anything to do with the grid.
You are probably using null/Nothing, which is not valid for a DataTable field. You have to use DBNull.Value, instead.