我是新来的MVC3 - 无法弄清楚为什么日期格式验证不能在客户端工作,即如果我手动更改文本框并输入格式日期无效。我在这个领域使用jQuery日期选择器。奇怪的是,必填字段验证正在工作。ASP.NET MVC3 - RAZOR - 日期格式验证不起作用
有人能让我知道这段代码有什么问题吗?
谢谢!
视图模型
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
[DataType(DataType.Date, ErrorMessage="Please enter a valid date in the format dd/mm/yyyy")]
[Required]
public DateTime ADate { get; set; }
VIEW
@Html.TextBox("ADate", Model.ADate.ToShortDateString(), new { @class = "ADate" })
@Html.ValidationMessageFor(model => model.ADate, "*")