I built a custom ValidationAttribute so I can validate unique email addresses in my system. However, I'd like to pass in a custom parameter somehow to add more logic to my validation.
public class UniqueEmailAttribute : ValidationAttribute
{
public override bool IsValid(object value)
{
//I need the original value here so I won't validate if it hasn't changed.
return value != null && Validation.IsEmailUnique(value.ToString());
}
}
Best Answer
Like this?
Use: