MVC 3 : 日期

在View中控制日期的显示格式: http://rachelappel.com/create-user-friendly-date-fields-with-asp.net-mvc-editortemplates-amp-jqueryui

 

\DisplayTemplates\DateTime.cshtml

@model DateTime   
@String.Format("{0:d}", Model.Date)

\EditorTemplates\DateTime.cshtml

@model DateTime
@Html.TextBox("", String.Format("{0:d}", Model.Date.ToShortDateString()))

 

posted @ 2011-07-15 16:55  Ken-Cai  阅读(577)  评论(0)    收藏  举报