, , Html.EditorFor(). EditorTemplates.
.
> > EditorTemplates
Add a new MVC 2 control to the EditorTemplates folder and name it DateTime.ascx. Html.EditorFor (DateTime) will now use this user control for display.
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime?>" %>
<%= Html.TextBox(string.Empty, (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty)) %>
source
share