导读 很多人对html代码大全,html textboxfor不是很了解那具体是什么情况呢,现在让我们一起来瞧瞧吧!1、Try this;@Html TextBoxFor(model =
很多人对html代码大全,html textboxfor不是很了解那具体是什么情况呢,现在让我们一起来瞧瞧吧!
1、Try this;@Html.TextBoxFor(model => model.CreationDate, new { @type = "date", @Value = Model.CreationDate.ToString("yyyy-MM-dd") })You have to handle null when setting the value.ORIf you can change the Model you can try this;[DataType(DataType.Date)][DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]public DateTime CreationDate{ get; set; }and in your view you can use EditorFor helper.@Html.EditorFor(model => model.CreationDate, new { @type = "date" })。
本文【html代码大全(html textboxfor)】到此讲解完毕了,希望对大家有帮助。
免责声明:本文为转载,非本网原创内容,不代表本网观点。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。