【发布时间】:2016-02-22 12:54:41
【问题描述】:
我正在创建一个 MVC 项目,我对它很陌生。我有一个具有日期时间属性的创建视图。
在 Html 中,它只是为 datetime 属性显示一个简单的文本框。我怎样才能使它成为日期和时间选择器?而且,下面是我的 HTML 代码...
<div class="form-group">
@Html.LabelFor(model => model.CreatedTime, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10 datetimepicker">
@Html.EditorFor(model => model.CreatedTime, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.CreatedTime, "", new { @class = "text-danger" })
</div>
</div>
我的模型类如下所示
public partial class AntsoftCrmProjectTransaction
{
public int Id { get; set; }
public int ProjectId { get; set; }
public int MinutesSpent { get; set; }
public string ProblemDescription { get; set; }
public bool ProblemIsFixed { get; set; }
public string ProblemResult { get; set; }
public string CurrentlyInCharge { get; set; }
public int SupportId { get; set; }
public int UserId { get; set; }
public System.DateTime CreatedTime { get; set; }
【问题讨论】:
-
你能告诉我们你的模型类吗?
-
顺便说一句,我不想要一个花哨的选择器,基本会为我完成这项工作
-
你用什么浏览器来测试这个?
标签: c# asp.net-mvc datetime datepicker