I would like to know if a way exists in asp.net mvc 2, to have multiple regular expression on a proprety. For example :
[RegularExpression(\"[^0-9]\", Error
Something like this:
public class DigitsAttribute : RegularExpressionAttribute
{
public DigitsAttribute()
: base("[^0-9]")
{
}
}
public class SpecialCharsAttribute : RegularExpressionAttribute
{
public SpecialCharsAttribute()
: base("[^<>]{2,}")
{
}
}
Use:
[Digits]
[SpecialChars]
public string City { get; set; }