Dig*_*mar 5 data-annotations asp.net-mvc-3
如何显示自定义错误消息
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
Run Code Online (Sandbox Code Playgroud)
我的模型中的代码如下,
[Display(Name = "When was that document issued?")]
[DataType(DataType.Date, ErrorMessageResourceName = "DocumentIssueDate_DataType",ErrorMessageResourceType = typeof(CustomErrorMessages))]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
public DateTime? DocumentIssueDate { get; set; }
Run Code Online (Sandbox Code Playgroud)
在我的视图中,当我在日期文本框中输入201时,我收到以下错误消息.如何修改以下错误消息.
值"201"对DocumentIssueDate无效.
归档时间: |
|
查看次数: |
5077 次 |
最近记录: |