Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. public class LocalPasswordModel
  2. {
  3. [Required]
  4. [DataType(DataType.Password)]
  5. [Display(Name = "Current password")]
  6. public string OldPassword { get; set; }
  7.  
  8. [Required]
  9. [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
  10. [DataType(DataType.Password)]
  11. [Display(Name = "New password")]
  12. public string NewPassword { get; set; }
  13.  
  14. [DataType(DataType.Password)]
  15. [Display(Name = "Confirm new password")]
  16. [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
  17. public string ConfirmPassword { get; set; }
  18. }
  19.  
  20. ErrorMessage = "The {0} must be at least {2} characters long."
  21.  
  22. {0} Property name
  23. {1} Maximum length
  24. {2} Minimum length
  25.  
  26. public override string FormatErrorMessage(string name)
  27. {
  28. EnsureLegalLengths();
  29. string format = ((this.MinimumLength != 0) && !base.CustomErrorMessageSet) ? DataAnnotationsResources.StringLengthAttribute_ValidationErrorIncludingMinimum : base.ErrorMessageString;
  30. return String.Format(CultureInfo.CurrentCulture, format, new object[] { name, MaximumLength, MinimumLength });
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement