Advertisement
Guest User

Untitled

a guest
Apr 15th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public class CompanyPreviewMeta
  2. {
  3. [Required]
  4. [Display(Name="Изображение")]
  5. public string Image { get; set; }
  6.  
  7. [Required]
  8. [Display(Name="Текст")]
  9. [StringLength(100, MinimumLength = 20, ErrorMessage = "Значение {0} должно содержать от {2} до 100 символов.")]
  10. public string Text { get; set; }
  11. }
  12.  
  13. ValidationContext ValidatorContext = new ValidationContext(model, null, null);
  14. List<ValidationResult> result = new List<ValidationResult>();
  15. bool valid = Validator.TryValidateObject(model, ValidatorContext, result, true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement