Suppose we have a TextBox named First_Name and we want to validate it in such a manner so that user can enter only characters in a TextBox.
We can use RegularExpressionValidator to validate First_Name. We just need to set the following RegularExpressionValidator properties:
ID | FirstName_Validator |
ControlToValidate | First_Name |
ErrorMessage | First Name is a character field. |
ValidationExpression | ^([A-Za-z])+$ |
Now if user enter any value in a First_Name TextBox other than characters, it will show an error message.
(Note- You can write your own Error Message and Control Names.)
(Note- You can write your own Error Message and Control Names.)
No comments:
Post a Comment