asp.net mvc3 数据验证(二)——错误信息的自定义及其本地化
;
[Required(ErrorMessage = "用户名不能为空!")] [Display(Name = "用户名")] [Remote("CheckUserName","Account")] public string UserName { get; set; }
[Required(ErrorMessage = "{0}不能为空!")] [Display(Name = "用户名")] [Remote("CheckUserName","Account")] public string UserName { get; set; }
[Required(ErrorMessage = "{0}不能为空!")] //[Display(Name = "用户名")] [Remote("CheckUserName","Account")] public string UserName { get; set; }
[Required] [StringLength(100, ErrorMessage = "请输入{2}到{1}位的{0}。", MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = "密码")] public string Password { get; set; }
[Required(ErrorMessageResourceType = typeof(ErrorMessages), ErrorMessageResourceName = "UserNameRequire")] [Display(Name = "用户名")] public string UserName { get; set; }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。