title: C# - ASP.NET - Calendar Control - Specified cast is not valid
body: <p>I have a gridview where I keep track of deadlines. I have 2 dates herefor. A expected date (date where the deadline is supposed to be completed) and an actual date  (date where the deadline was completed). Now in my DB all the expected dates have values because they are meant to finish at around the same date each month. However the actual date is blank. </p>
  
  <p>This gives me following error due to the null-values: <code>Exception Details: System.InvalidCastException: Specified cast is not valid.
  </code> </p>
  
  <p>Now I found something while looking on the Internet and that is to call a helper method (see the selectedDate property - I copied to same value of selectedDate into VisibleDate, because else I had the same error) However this presents me with another error which is that I can't get the newly selected value!         </p>
  
  <pre><code>&lt;asp:TemplateField HeaderText="Actual Date" SortExpression="Actual_Date"&gt;
      &lt;EditItemTemplate&gt;
          &lt;asp:Calendar ID="Calendar2" runat="server" VisibleDate='&lt;%# Bind("Actual_Date") %&gt;' SelectedDate='&lt;%# FixNullDate(Eval("Actual_Date")) %&gt;'&gt;&lt;/asp:Calendar&gt;
      &lt;/EditItemTemplate&gt;
      &lt;ItemTemplate&gt;
          &lt;asp:Label ID="Label2" runat="server" 
              Text='&lt;%# Bind("Actual_Date", "{0:d}") %&gt;'&gt;
          &lt;/asp:Label&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>Here is my code of from my templatefield for the actual date</p>
  
  <p>Please help, I'm kinda lost :p</p>