title: jQuery Datetime picker MVC3
body: <p>I have in my Model this field</p>
  
  <pre><code>[DataType(DataType.DateTime)]
      [Required(ErrorMessage = "Expire is required")]
      public DateTime Expire
      {
        get;
        set;
      }
  </code></pre>
  
  <p>In My View</p>
  
  <pre><code>@Html.EditorFor(model =&gt; model.Expire))
        @Html.ValidationMessageFor(model =&gt; model.Expire)
  </code></pre>
  
  <p>and I create DataTime EditorTemplates</p>
  
  <pre><code>@inherits System.Web.Mvc.WebViewPage&lt;System.DateTime&gt;
  @Html.TextBox("", (Model.ToShortDateString()), new { @class = "datePicker" })
  &lt;script type='text/javascript'&gt;
    $(document).ready(function () {
      $(".datePicker").datepicker({
        //      buttonImage: "/content/images/calendar.gif",
        //      showOn: "both",
        //      defaultDate: $("#calendar-inline").attr('rel')
        showAnim: 'slideDown',
        dateFormat: 'dd/mm/yyyy'
  
      });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>when i try to Create new Item I have this error message</p>
  
  <blockquote>
    <p>The model item passed into the
    dictionary is null, but this
    dictionary requires a non-null model
    item of type 'System.DateTime'</p>
  </blockquote>
  
  <p>I try </p>
  
  <pre><code>Model.HasValue ? Model.Value.ToString("MM/dd/yyyy") : DateTime.Today.ToShortDateString()
  </code></pre>
  
  <p>But i not have in Model Value check</p>