Subscribe:

Labels

Mobile Number Validation In ASP.NET

You can validate mobile number in ASP.NET and for that follow the below steps.
  • First add regular expression validator for the particular textbox.
  • Now the right click on regular expression validator and set "Errormessage" propert as "Enter Valid Mobile Number",Set ControlToValidate as textboxname you want to validate and select expression property.
  • Various validation will come up select any of them and according to your selection expression will be shown below.
  • Delete whole expression and enter the below expression.

^[7,8,9]{1}[0-9]{9}$ (To Validate General Mobile Number)

^((\+){0,1}91(\s){0,1}(\-){0,1}(\s){0,1}){0,1}9[0-9](\s){0,1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$ (To Validate Indian Mobile Number)

Press ok and you have done it.

2 comments: