Html 日期未显示在EditorFor中
我想在editorfor字段中显示数据库中的值,但该字段保持空白。值出现在值字段中,但不显示在页面中。 如果我使用的解决方案来自: 我得到的是值,但不是EditorFor字段默认提供的日期选择器 型号:Html 日期未显示在EditorFor中,html,entity-framework,asp.net-mvc-4,Html,Entity Framework,Asp.net Mvc 4,我想在editorfor字段中显示数据库中的值,但该字段保持空白。值出现在值字段中,但不显示在页面中。 如果我使用的解决方案来自: 我得到的是值,但不是EditorFor字段默认提供的日期选择器 型号: [Required] [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)] public DateTime Van{ get;
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
public DateTime Van{ get; set; }
视图:
将格式更改为“yyyy/MM/dd”后,这是一个Chrome问题。是否使用Jquery datepicker?
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
public DateTime Van{ get; set; }
@Html.EditorFor(model => model.Van, new { htmlAttributes = new { @class = "form-control" } })