Password
[Required]
[DataType(DataType.Password)]
[Display(Name = "Current password")]
public string OldPassword { get; set; }
[Required]
[EmailAddress(ErrorMessage = "Not a valid Email Address.")]
[Display(Name = "Email")]
public string Email { get; set; }
比较2个数值用Compare。
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
[DataType(DataType.Password)]
[Display(Name = "Confirm password")]
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
Number Only
[Required]
[RegularExpression(@"^\d+$", ErrorMessage = "Please Entry Number")]
[Display(Name = "Term Order")]
public int TermOrder { get; set; }