【发布时间】:2015-09-06 22:57:30
【问题描述】:
我在 mvc5 中编程,但遇到了问题。
我的模特:
[DataType(DataType.Date)]
[Required(ErrorMessage = "Required")]
public System.DateTime Date { get; set; }
[DataType(DataType.Time)]
[Required(ErrorMessage = "Required")]
public System.DateTime Time { get; set; }
查看:
<div class="form-group">
@Html.LabelFor(model => model.Date, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Date, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Date, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Time, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Time, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Time, "", new { @class = "text-danger" })
</div>
</div>
当我使用 Google chrome 日期选择器和时间选择器时显示正确,但是当我使用 mozilla firefox 时,这只是一个文本框。
我怎样才能概括它?我希望始终拥有日期选择器和时间选择器。
【问题讨论】:
-
FireFox 不支持 HTML5
input type="date"。参考comparison table
标签: asp.net-mvc browser datepicker timepicker