I am trying to use a regular expression to validate a phone number and return an error when an invalid number or phone number is submitted.
MVC Code
Along with the above answers Try this for min and max length:
In Model
[StringLength(13, MinimumLength=10)]
public string MobileNo { get; set; }
In view
@Html.TextBoxFor(m => m.MobileNo, new { @class = "form-control" , type="phone"})
@Html.ValidationMessageFor(m => m.MobileNo,"Invalid Number")
@Html.CheckBoxFor(m => m.IsAgreeTerms, new {@checked="checked",style="display:none" })