<p>In my ASP.net MVC app I have a view that looks like this:</p>

<pre><code>...
&lt;label&gt;Due Date&lt;/label&gt;
&lt;%=Html.TextBox("due")%&gt;
...
</code></pre>

<p>I am using a <code>ModelBinder</code> to bind the post to my model (the due property is of <code>DateTime</code> type). The problem is when I put "01/01/2009" into the textbox, and the post does not validate (due to other data being input incorrectly). The binder repopulates it with the date <strong>and time</strong> "01/01/2009 <strong>00:00:00</strong>". </p>

<p><strong>Is there any way to tell the binder to format the date correctly (i.e. <code>ToShortDateString()</code>)?</strong></p>

In order to get strongly typed access to your model in the code behind of your view you can do this:
```
```
public partial class SomethingView : ViewPage<T>
{
}
```
```
Where T is the ViewData type that you want to pass in from your Action.
Then in your controller you would have an action :
```
```
public ActionResult Something(){
    T myObject = new T();
    T.Property = DateTime.Today();

    Return View("Something", myObject);
}
```
```
After that you have nice strongly typed model data in your view so you can do :
```
```
<label>My Property</label>
<%=Html.TextBox(ViewData.Model.Property.ToShortDateString())%>
```
```