I want to user to enter only numbers and characters in textbox i.e no special charaters.
I don’t want to use key press event of textbox.
As i need same validation in gridview.
So i want to validate whole string.
Thanks in advance.
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.
Using the Regex class for regular expressions you can use:
EDIT: I forgot to add the
^and the$to denote that the match should go from start to finish on the string. You’ll also need to put a\sin there if whitespace is allowed.