Null date in pop up calender


I have a datagrid with date field.  I displaying this date field by using calender pop up from Excentrics World.  When the date field is not null, it's working fine, but if the date field is null I am getting this error:
I am not looking for another calender pop up.  I am very happy with this tool, all I need to do is allow the null date to open in datagrid edit mode as empty and let the user enter a new date.  please help.

Exception Details: System.InvalidCastException: Cast from type 'DBNull' to type 'Date' is not valid.

Source Error:

Line 77:       </ItemTemplate>
Line 78: <EditItemTemplate>
Line 79: <ew:CalendarPopup id="Calendarpopup3" runat="server" ShowGoToToday="True" nullable = "true" SelectedDate='<%#
Line 80: DataBinder.Eval(Container.DataItem, "disabled_date") %>'>
Line 81: </ew:CalendarPopup>

Here is the datagrid code:

asp:TemplateColumn HeaderText="Disabled Date">
<ASP:Label Text='<%# DataBinder.Eval(Container.DataItem, "disabled_date") %>' runat="server" ID="Label10" />
<ew:CalendarPopup id="Calendarpopup3" runat="server" ShowGoToToday="True" nullable = "true" SelectedDate='<%#
DataBinder.Eval(Container.DataItem, "disabled_date") %>'>
Who is Participating?
EBatistaConnect With a Mentor Commented:
iboutchkineConnect With a Mentor Commented:
There is no easy way to handle null values with DateTimePicker control shipped
with .net.
However, I have heard that the customized control by Lutz Roeder supports null
values. It is a free download that you might want to download and test out in
your project.

Here is the link to his site:

Here is another example . It is in C#, but you will get an idea
suran78Author Commented:
I tried by creating a setdate function, but I am getting this error at line 58:

Compiler Error Message: BC30390: 'chlorAlkali.createcells.Private Function SetDate(theDate As Object) As Object' is not accessible in this context because it is 'Private'.

Source Error:

Line 56:                                     </ItemTemplate>
Line 57:                                     <EditItemTemplate>
Line 58:                                     <ew:CalendarPopup id="Calendarpopup3" runat="server" SelectedDate='<%# SetDate(Container.DataItem("disabled_date")) %>'>
Line 59:                                           </ew:CalendarPopup>
Line 60:                                     </EditItemTemplate>
Added this function in code behind:
Friend Function SetDate(ByVal theDate As Object)

        If theDate Is DBNull.Value Then
            Return DateTime.MinValue
            Return theDate
        End If

    End Function
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

suran78Author Commented:
Got it resolved.  Just removed friend from the function.   Thanks
glad to help
suran78Author Commented:
I have 3 more question open.  Please reply if interested
All Courses

From novice to tech pro — start learning today.