Checking string's length with validator controls

P

Pierre

I need to check the length of a string in a textbox control. I used
RegularExpressionValidator with ".{0,20}" to check if the string is between
0 and 20 characters. Is it possible to use the other validator classes to
check a string's length? I tried RangeValidator but it seems that it checks
for alphabetical order. Thanks for replies.
 
D

David

I need to check the length of a string in a textbox control. I used
RegularExpressionValidator with ".{0,20}" to check if the string is between
0 and 20 characters. Is it possible to use the other validator classes to
check a string's length? I tried RangeValidator but it seems that it checks
for alphabetical order. Thanks for replies.

CustomValidator would work, but why not just set the maxlength of the
textbox to 20? (Sure, you'd still need to double-check on the server
side to avoid malicious spoofing, but you don't really need nice
good-looking validator controls for that.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top