How to format the value in a strongy typed view when using ASP.Net MVC's Html.TextBoxFor

Posted by Paul Speranza on Stack Overflow See other posts from Stack Overflow or by Paul Speranza
Published on 2010-01-18T18:06:23Z Indexed on 2010/04/29 8:07 UTC
Read the original article Hit count: 441

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about mvc