I am using sharepoint validation control to validate only numbers but whatever i enter it says "please enter valid number". What is wrong with my validation expression?

<SharePoint:InputFormRegularExpressionValidator ID="NumberValidator"  runat="server" Display="Dynamic" SetFocusOnError="true"
                        ControlToValidate="txtMobile" BreakBefore="true" ErrorMessage="Please nter valid number"  ValidationExpression="^[0-9]$"/>

2 Answers 2


Hi actualy your validation express is correct same working for me but it was allowing spaces so i tried bellow mentioned validation express. try this and let me know whether it was helpfull or not.


If you want more details about the validation regular expression you can visit bellow mentioned link

Regular expression for validation controls

  • its working with your answer. Not sure why not working with my validatoin expression Commented Jul 23, 2015 at 10:17
  • I am also not Sure why your exp is not working, if you feel answer was usefull mark it as answer and vote it, thank you :-) Commented Jul 23, 2015 at 10:28

Your Regular Expression will only work for 1 digit. To accept 1 or more digits, change it to ^[0-9]+$. To accept 0 or more digits, change it to ^[0-9]*$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.