How can you annotate phone number data annotation for phone number validation?
Is there way to allow this format in front-end like using HTML5 pattern? I know that there is data type for phone number in both HTML5 and MVC3 but was wondering if we can format that in something like (000)-000-0000 or 000-000-0000 so user can not enter more than 10 digits and if he enters a phone it displays in above formats. I tried this so far:
[Required]
[DataType(DataType.PhoneNumber)]
[RegularExpression(@"^(\d{10})$", ErrorMessage = "Please enter proper phone number.")]
[Display(Name = "phone")]
public string Phone { get; set; }