If a user enters a non-numeric value into a TextBox and presses a Button, I want to show an error message on a Label.
How can I achieve this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Are you saying you want to allow numbers only?
If this will allow numbers only, but will also allow you to skip the box entirely. If you want to make it required, add this:
Update: If you would like to accept decimal values like “3.5” in addition to just “3”, modify the ValidationExpression in the RegularExpressionValidator I supplied above to read “^\d+(\.\d+)?$”