MVC 3 Editor Template with DateTime

混江龙づ霸主 提交于 2019-11-27 13:38:22

问题


I want to change this code from MVC2

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %>

  <%=Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" }) %>

To MVC 3 using Razor.

You can find the full post of what I want to do here


回答1:


@model DateTime?

@Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" })


来源:https://stackoverflow.com/questions/4249955/mvc-3-editor-template-with-datetime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!