How to Range validation integer ASP.NET MVC 3
asp.net-mvc-3, data-annotations, validation
Solution
Try this:
[RegularExpression("^[0-9]{10}$", ErrorMessage = "Invalid Mobile No")]
Problem
I'm using validations as below. ``` [Required(ErrorMessage = "Please provide 10 digit mobile number without spaces and without country code (+91)")] [Integer(ErrorMessage = "Please provide 10 digit mobile number without spaces and without country code (+91)")] [Range(1000000000, 9999999999, ErrorMessage = "10 digit mobile number only without spaces and without country code (+91)")] [Display(Name = "Mobile Number")] public int MobileNo { get; set; } ``` It is always failing the validations saying `The value '9999999998' is invalid.`. Am I doing something wrong?