我有查看模型iwth字段:
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime? FirstRegistration { get; set; }
输入表格:
@Html.TextBoxFor(m => m.FirstRegistration, "{0:dd/MM/yyyy}", new {@class = "input-sm form-control"})
问题是有时(在模型状态无效时返回视图后):
if (!ModelState.IsValid) return View(model);
格式完全被忽略。有什么问题?