title: datepicker passing null value to controller
body: <p>I am using datepicker in my view in my mvc project for two text box ie start date and end date and when i click on submit button my date in the end date text box not passes to controller.It pass default date 01/01/0001.It is showing date in alert("EndDate"); but not passing to controller. start date is passing.</p>
  
  <pre><code>$(document).ready(function () {
      $('#StartDate').datepicker({
          changeMonth: true,
          changeYear: true
      }).on('changeDate', function (e) {
  
          $(this).datepicker('hide');
      });
  
      $('#EndDate').datepicker({
          changeMonth: true,
          changeYear: true
      }).on('changeDate', function (e) {
          $(this).datepicker('hide');
          //alert($('#EndDate').val());
      });
  });
  function Submit()
  {
      var StartDate = $("#StartDate").val();
      var EndDate = $("#EndDate").val();
      if (EndDate &lt; StartDate) {
          alert("Enddate:" + EndDate + " should be greater than Startdate:" + StartDate);
      }
      else {
          //alert(2);
          $('#form').submit();
      }
  }
  </code></pre>
  
  <p>view</p>
  
  <pre><code>@using (Html.BeginForm("Create", "Admin", FormMethod.Post, new { @id= "form" }))
  {
  @Html.AntiForgeryToken()
  
  &lt;div class="form-horizontal"&gt;
  
      @Html.ValidationSummary(true)
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.PromoCode, new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              @Html.EditorFor(model =&gt; model.PromoCode)
              @Html.ValidationMessageFor(model =&gt; model.PromoCode)
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.StartDate, new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              &lt;input type="text" name="StartDate" id="StartDate" /&gt;
              @Html.ValidationMessageFor(model =&gt; model.StartDate)
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.EndDate, new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              &lt;input type="text" name="EndDate" id="EndDate" /&gt;
              @Html.ValidationMessageFor(model =&gt; model.EndDate)
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          @Html.LabelFor(model =&gt; model.NewUsers, new { @class = "control-label col-md-2" })
          &lt;div class="col-md-10"&gt;
              @Html.EditorFor(model =&gt; model.NewUsers)
              @Html.ValidationMessageFor(model =&gt; model.NewUsers)
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;div class="col-md-offset-2 col-md-10"&gt;
              &lt;button type="button" class="btn btn-primary" onclick="Submit();"&gt;Create&lt;/button&gt;
              @*&lt;input id="submit" type="button" value="Create" class="btn btn-default" /&gt;*@
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>}</p>
  
  <p>Controller</p>
  
  <pre><code>public ActionResult Create(Coupons objCoupons)
  {        
    try
    {
      //hrllo =nhui
    }
    catch
    {
      return View();
    }
  }
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>public class Coupons
  {
      [Required(ErrorMessage = "*")]
      [DataType(DataType.Date)]
      [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
      public DateTime StartDate { get; set; }
  
      [Required(ErrorMessage = "*")]
      [DataType(DataType.Date)]
      [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
      public DateTime EndDate { get; set; }
  }
  </code></pre>