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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -