DarinAlred
asked on
Gridview and "NULL" DateTime
I have a Gridview with an ObjectDataSource bound to it. The class handling the SelectMethod returns some DateTime fields that are for all purposes NULL, but actually DateTime.MinValue since a DateTime cannot be NULL.
I don't want to display these values in the Gridview, since they don't make any sense. Is it bad form to type a method as Object and return different types like so:
public object Fax
{
get
{
if (fax.Date == DateTime.MinValue)
{
return null;
}
else
{
return fax;
}
}
set { fax = (DateTime)value; }
}
If it is, how could I inform the Gridview to hide the DateTime.MinValue?
I don't want to display these values in the Gridview, since they don't make any sense. Is it bad form to type a method as Object and return different types like so:
public object Fax
{
get
{
if (fax.Date == DateTime.MinValue)
{
return null;
}
else
{
return fax;
}
}
set { fax = (DateTime)value; }
}
If it is, how could I inform the Gridview to hide the DateTime.MinValue?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.