I have a SQL 2005 table. One of the columns contains decimal values, sometimes the value would be null. The grid displays these decimal nulls as "0". I want the grid to display an empty cell and not "0".
I've tried the InitializeColumn and InitializeRow without success with the following code:
if (column.Key == "MyDecimalColumn")
{ column.Nullable = Nullable.Null;
column.NullText = "";}
Please assist. Thank you
Thanks Mike, your suggestions steered me into the right direction. It's fixed, thanks!
Hi,
I tried this out and I do not get the behavior you describe. The grid does not replace null values with 0's for a decimal column. Null values are display as an empty string. I also tested the NullText property and it works just fine for me.
So if you are seeing "0"s in the cell, it must be something in your code that is doing this. Are you sure your DataSource is returning null or DBNull.Value? What kind of data source are you using? Are you sure the DataType of the column is Decimal? Are you applying a Format to the column?