Numbers or letters in a TextBox

  • Thread starter Thread starter Pablo
  • Start date Start date
How I can have a TextBox that to only lets me enter
letters or numbers?


You'll need to use Client side javascript.

Or, you can put a custom validator on the server side and check the input.
 
You should always have a server side validator, just in case some of your
users don't support JavaScript (or they turned it off). And remember,
postbacks do not have to come from your page, it's so simple to fake a form
submission with made up values. The moral is never trust anything that comes
from the client, no matter how much validating JavaScript you have there.

Jerry
 
Back
Top