Rank: Advanced Member Groups: Member
Joined: 6/5/2007 Posts: 76
|
When using the datepicker control to edit and existing date/time field and the database value is null, I get an error.
Is there a way to take into account that some date/time fields when being edited may not already have an existing date/time?
Conversion from type 'DBNull' to type 'Date' is not valid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'Date' is not valid.
Source Error:
Line 90: <asp:TemplateField HeaderText="Ends" SortExpression="event_enddate"> Line 91: <EditItemTemplate> Line 92: <eo:DatePicker ID="DatePicker3" runat="server" ControlSkinID="None" DayCellHeight="16" Line 93: DayCellWidth="21" DayHeaderFormat="FirstLetter" DisabledDates="" GridLineColor="207, 217, 227" Line 94: GridLineFrameVisible="False" GridLineVisible="True" PickerFormat="dd/MM/yyyy HH:mm"
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Paul,
You won't be able to do that. The error is actually thrown out by ASP.NET pager compiler. The solution is to use what you have already found ---- SelectedDataString property.
Thanks
|