I tried the following code for digits-only validation for a contact number validation in Mvc web app.
[RegularExpression(@\"/(^\\(\\d{10})?)$/\", ErrorMessage =
If don't have any restrictions other than numbers only, this should fit:
[RegularExpression(@"^\d+$", ErrorMessage = "Please enter proper contact details.")] [Required] [Display(Name = "Contact No")] public string ContactNo { get; set; }