I have the following, if I type in to a text box with a binding that has this annotation
[ExcludeChar("@")] // Custom data annotationpublic string APPLICANT_Surname;
it steps through and hits the right line but not not show as an error, the other annotations do.
public class ExcludeChar : ValidationAttribute { private readonly string _chars; public ExcludeChar(string chars) : base("{0} contains invalid characters") { _chars = chars; } protected override ValidationResult IsValid(object value, ValidationContext validationContext) { if (value != null) { for (int i = 0; i < _chars.Length; i++) { var valueAsString = value.ToString(); if (valueAsString.Contains(_chars[i].ToString())) { var errorMessage = FormatErrorMessage(validationContext.DisplayName); return new ValidationResult(errorMessage); } } } return ValidationResult.Success; } }Am I missing something?