I'm new with MVC2, and am having a formatting problem. I have a DateTime property in my Employee model that I would like displayed with the Short Date Time.
This however, does not appear to be the correct method.
1 <div class="editor-field">
2 <%: Html.TextBoxFor(model => model.DateRequested.ToShortDateString()) %>
3 <%: Html.ValidationMessageFor(model => model.DateRequested) %>
4 </div>
Line 2 throws this exception:
Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
What is the correct way to handle formatting in mvc?