HTMLヘルパー EditorForでカスタムテンプレートを使うViews/Home/index.cshtml@Html.EditorFor(m => m.MyDate, "_DateEditor") Views/Shared/EditorTemplates/_DateEditor.cshtml @model DateTime
@Html.TextBox("", Model.ToString("yyyy-MM-dd"),
new { @Value = Model.Year <= 1900 ? "" : Model.ToString("yyyy-MM-dd")})
参考http://stackoverflow.com/questions/3735400/html-attributes-for-editorfor-in-asp-net-mvc |
|