Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2012 Displaying null date in DataGrid

$
0
0
Okay, I've got a DataGrid that is displaying data from our database, except when it runs across a NULL datetime value in the database it displays it as "1/1/0001 12:00:00 AM". I'd MUCH rather have it show an empty field in that case... how do I get it to do that?

This is how I've got the control defined in the DataGrid's XAML.

Code:

                <DataGridTemplateColumn Header="Start Date">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding EffDateBegin}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                    <DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <DatePicker SelectedDate="{Binding EffDateBegin}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellEditingTemplate>
                </DataGridTemplateColumn>

I'm using .NET 4.5 in a wpf app...

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>