I am using Ultragrid in c# .net windows application,
I used a column of datatype System.DateTime
., On page loading it is showing empty (like '--/--/--'
),
aftrer some validations i want to make that column empty
when am trying to make that column empty, it is taking current date as default or '01/01/0001'
.
i made defaultvalue to null.
How to make empty that column means it should show like '--/--/--'
This is probably an issue with your DataSource
, not the grid.
The DateTime
data type in DotNet is a struct, so it can't be null. If you use a DataSet
/DataTable
or UltraDataSource
as the data source for your grid, then these objects store everything as an object so that they can handle null or DBNull
. My guess is that you are probably binding the grid to a list of your own custom classes and the DataType of the field is DateTime
and cannot accept nulls.
If you are using CLR2
, maybe you can use a nullable
DateTime
, instead. You might have to set the Nullable
property on the column to Nothing, though, since even a nullable
type can't handle DBNull
.