Nam*_*mar 0 asp.net-mvc data-annotations
我需要使用数据注释来验证所有印度手机号码。在我的模型中,我使用以下代码
[Required]
[Display(Name = "Mobile Number")]
[CustomRemote("IsMobileNoAvailable", "Employees",
ErrorMessage = "Mobile No already in use", AdditionalFields = "Id")]
[?]
public string ContactNumber { get; set; }
Run Code Online (Sandbox Code Playgroud)
但是我很困惑我需要写些什么来代替[?]吗?请建议我验证手机号码的最佳方法。
小智 5
尝试这一希望它会对您有所帮助。
[RegularExpression(@"^([0]|\+91[\-\s]?)?[789]\d{9}$", ErrorMessage = "Entered Mobile No is not valid.")]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7190 次 |
| 最近记录: |