C# 编辑行数据时无法将日期绑定到表单
成功将日期以“dd-MM-yyyy”格式提交到数据库中。当我编辑日期时,我会在我的控制器中得到类似“23-03-2020 00:00:00”的日期。但不要在文本框中获取值C# 编辑行数据时无法将日期绑定到表单,c#,asp.net,.net,asp.net-mvc,asp.net-mvc-4,C#,Asp.net,.net,Asp.net Mvc,Asp.net Mvc 4,成功将日期以“dd-MM-yyyy”格式提交到数据库中。当我编辑日期时,我会在我的控制器中得到类似“23-03-2020 00:00:00”的日期。但不要在文本框中获取值 ``` [Display(Name = "Exam Date")] [DataType(DataType.Date)] [DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMod
```
[Display(Name = "Exam Date")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd-MM-yyyy}", ApplyFormatInEditMode = true)]
@Html.EditorFor(model => model.Examdate,new { htmlAttributes = new { @class = "form-control", @id = "Examdate", @autocomplete = "off"} })
```