【发布时间】:2014-11-04 02:55:33
【问题描述】:
我在 ASP .NET MVC 5.1 中编写应用程序
我有一个字段:
[DisplayName("Date of Birth")]
[DataType(DataType.Date)]
public DateTime BirthDate { get; set; }
然后在视图中
<div class="form-group">
@Html.LabelFor(model => model.BirthDate, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.BirthDate, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.BirthDate, "", new { @class = "text-danger" })
</div>
</div>
翻译为:
如果我只是将模型中属性上方的注释更改为:
[DisplayName("Date of Birth")]
[DataType(DataType.DateTime)]
我没有显示任何选择器。如果我将它们更改为:
[DisplayName("Date of Birth")]
[DataType(DataType.Time)]
只有 hh:mm 可供选择。
问题: 在 ASP .NET MVC 5.1 中显示日期时间选择器而不是日期选择器。我要求 ASP .NET 5.1 HTML 5 特定解决方案。
【问题讨论】:
标签: c# razor datepicker asp.net-mvc-5.1