Hi,
I have a column which is binded to a datetime field in an object. The Column style is "Date" and the data type is "System.DateTime".
Whenever I try to add a new row and I press the drop down button to see the calendar I get the following exception:
System.ArgumentOutOfRangeException: Value of '01/01/0001' is not valid for 'SelectionEnd'. 'SelectionEnd' must be greater than or equal to MinDate.Parameter name: SelectionEnd
After I press on "Continue" I see the value 01/01/0001 in the cell.
Maybe setting the default value to today might solve it, but how do I do it?
Thanks
I would have to say that the problem is with your bound object, not the grid per se. Since DateTime is a value type, not a reference type, it always holds some value and can never be null (Nothing in VB). You may try using a 'Nullable(of DateTime)' field rather than a datetime field. The Nullable structure encapsulates a value type and allows you to treat it (sort of) as a reference type instance. So your field can have a value of null (or Nothing). Otherwise, I'm not really sure how the grid will handle this. I always bind to DataTable objects (which of course allow DBNull for column values).
If you do want to have the value of Today be the default then I suppose you would want to include that as part of the constructor on your object.
mattphillips said:You may try using a 'Nullable(of DateTime)' field rather than a datetime field.
If you use the Nullable date Time type you don't see the DateTime.MinValue in the cell which is good, but you don't get the date picker either.
is there a way to force the column display a dete picker?
thanks !
nevermind
column.Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Date;