asp.net MVC 4 SSN Validation -


i using asp.net mvc 4 , looking attribute ssn validation.

[required(errormessage = "social security required")] [ssn] public string ssn { get; set; } 

i know doesn't work, looking for.

can help

you need use regex. try this.

[required(errormessage = "ssn required")] [regularexpression(@"^\d{9}|\d{3}-\d{2}-\d{4}$", errormessage = "invalid social security number")] public string ssn { get; set; } 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -