我正在尝试更改绑定字段的日期格式,但它不会更改
视图模型:
[Required (ErrorMessage="From Date is required")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
public DateTime FromDate { get; set; }
查看:
@Html.EditorFor(Model => Model.FromDate, new { htmlAttributes = new { @class = "form-control searchbox-border", placeholder = "From Date" } })