问题描述
我删除了日历小部件中的时间选择和字段中的开始日期,也没有时间。 但是主要的问题是,当您选择一个日期时,当前时间仍会插入该字段中。只需要显示日期,不需要时间。
cshtml
<div class="form-group">
@Html.LabelFor(model => model.Dateto,htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Dateto,"{0:d}",new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Dateto,"",new { @class = "text-danger" })
</div>
js
$("#Dateto").datetimepicker({
timepicker: false,pickTime: false,cloSEOnDateSelect: true,dateFormat: "yy/mm/dd"
});
型号
[display(Name = "Dateto",ResourceType = typeof(Resources.Resource))]
[displayFormat(DataFormatString = "{0:dd.MM.yyyy}",ApplyFormatInEditMode = true)]
[required]
public DateTime Dateto { get; set; }
jQuery DateTimePicker插件v2.4.5 如果有简单的替代ASP.NET小部件,请告知。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)