title: Html TextBoxFor always shows my DateTime? value with a time included even when I override in asp.net mvc 2. why?
body: <p>I have an edit object view. In this view are several DateTime? properties that are using:</p>
  
  model.MyDateTime ) %>
  
  <p>I have an editor template named DateTime that is strongly typed against a DateTime? type. The view is declared as follows:</p>
  
  <pre><code>&lt;%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl&lt;DateTime?&gt;" %&gt;
  
  &lt;% if( Model.HasValue ) { %&gt;
      &lt;%= Html.TextBoxFor( x =&gt; Model, Model.Value.ToShortDateString() ) %&gt;
  &lt;% } else { %&gt;
      &lt;%= Html.TextBoxFor(x =&gt; Model) %&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>The time portion is always displayed no matter what I do. I know the display template is being rendered. I've added static text for the if output as well as the else output and the former always shows. The incredibly odd thing is I can do:</p>
  
  <pre><code>&lt;%= Html.Encode(Model.Value.ToShortDateString())   %&gt;
  </code></pre>
  
  <p>And no time portion is displayed. I'm rather stumped. Below are the GET &amp; POST actions I am using:</p>
  
  <pre><code>   public ActionResult EditAssociate(int? Oid)
      {
          if (!Oid.HasValue)
              return RedirectToAction("SelectReviewYearAndAssociate");
          MpaNonExemptData mpaNonExemptRecord = repository.getNonExemptDataByOid(Oid.Value);
          return View(mpaNonExemptRecord);
      }
  
  [HttpPost]
  public ActionResult EditAssociate(MpaNonExemptData associate)
  {
      repository.updateNonExemptDataByOid(associate);
      return View(associate);
  }
  </code></pre>
  
  <p>As you can see, it's really straightforward. Any thoughts?</p>
  
  <p>I have looked at the following questions, but did not find an answer:</p>
  
  <p><a href="https://stackoverflow.com/questions/5252546/textboxfor-date-object-always-shows-time-element">TextBoxFor Date object always shows time element</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6221691/textboxfor-helper-retains-previous-value-even-when-model-value-is-empty">TextBoxFor Helper retains previous value even when model value is empty</a></p>