I have embedded an asp:Calendar control into the EditItemTemplate of GridView column. I have set the SelectedDate='<%# Bind("Finished") %>' VisibleDate='<%# Eval("Finished") %>', to the AccessDataSource's 'Finished' column (a Date type). The control correctly binds to the column if the date isn't null. If the column is null, I get an error that reads: Conversion from type 'DBNull' to type 'Date' is not valid. What am I missing here? Is there an easy fix? Thanks, Craig Buchanan
Here you have an article that explains how to avoid this in PreRender: http://www.c-sharpcorner.com/UploadFile/sd_patel/ASPNetCalendarControl11222005054337AM/ASPNetCalendarControl.aspx Some other guys tell to extend the calendar control in order to handle null values in the get/set property of the calendar control: http://forums.asp.net/p/1046084/1468000.aspx HTH Braulio /// ------------------------------ /// Braulio Diez /// /// http://www.tipsdotnet.com /// ------------------------------ "Craig Buchanan" wrote: > I have embedded an asp:Calendar control into the EditItemTemplate of > GridView column. I have set the SelectedDate='<%# Bind("Finished") %>' > VisibleDate='<%# Eval("Finished") %>', to the AccessDataSource's 'Finished' > column (a Date type). > > The control correctly binds to the column if the date isn't null. If the > column is null, I get an error that reads: > > Conversion from type 'DBNull' to type 'Date' is not valid. > > What am I missing here? Is there an easy fix? > > Thanks, > > Craig Buchanan > > >