Format Date On Binding (ASP.NET MVC)

后端 未结 12 740
感情败类
感情败类 2021-01-31 08:46

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

...

<%=Html.TextBox(\"due\")%>
...

I am usi

12条回答
  •  执念已碎
    2021-01-31 09:09

    This worked for me: mvc 2

    <%: Html.TextBoxFor(m => m.myDate, new { @value = Model.myDate.ToShortDateString()}) %>

    Simple and sweet!

    A comment of user82646, thought I'd make it more visible.

提交回复
热议问题