How to format the value in a strongy typed view when using ASP.Net MVC's Html.TextBoxFor
- by Paul Speranza
I am trying to format a date rendered by ASP.Net MVC's TextBoxFor using the value of a strongly typed view. The date is nullable so if it is null I want to see a blank value, otherwise I want to see it in the format MM/dd/yyyy.
<%= Html.TextBoxFor(model => model.BirthDate, new { style = "width: 75px;" })%>
Thanks,
Paul Speranza