Checking string's length with validator controls

  • Thread starter Thread starter Pierre
  • Start date Start date
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.
 
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.)
 
Back
Top