This is a migrated thread and some comments may be shown as answers.

Nullable Dates in GridView

1 Answer 216 Views
GridView
This is a migrated thread and some comments may be shown as answers.
+++AAA+__WOULD BUY AGAIN ++++
Top achievements
Rank 1
+++AAA+__WOULD BUY AGAIN ++++ asked on 13 Aug 2012, 08:16 PM
I'm trying to bind a nullable date to a column like this:

<telerik:GridViewDataColumn DataMemberBinding="{Binding DueDate}" DataFormatString="{} {0:dd, MMM, yyyy}"  Header="Due Date"
<telerik:GridViewDataColumn DataMemberBinding="{Binding MyFavoriteDate}" DataFormatString="{} {0:dd, MMM, yyyy}"  Header="Le Date" IsReadOnly="True" DataType="{x:Type System:DateTime}"/>

Where 'MyFavoriteDate' is a nullable date on my view model.  When the date is null, the column displays "01/01/0001".  I would expect the grid to display an empty value.  How do you bind to nullable types?

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 14 Aug 2012, 05:52 AM
Hello,

I have tested the problem you have described but I was not able to get the "01/01/0001" DateTime. I got an empty value displayed. Please find a sample project showing my test attached for a reference.

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
+++AAA+__WOULD BUY AGAIN ++++
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or