You certainly can do it with the existing validators and no coding because
Regular Expressions can handle it.
Use the RegularExpressionValidator with this Expression where you replace
the numbers with the lengths you want for min and max:
^.{4,10}$
If you want a more powerful solution, my TextLengthValidator, part of my
"Professional Validation And More" product
(
http://www.peterblum.com/vam/home.aspx) includes:
- The ability to show the current number of characters in the error message
itself. For example, "Keep it between 4 and 10 characters. You typed 12."
- Regular expressions are a far slower way to process over simply testing
the length of the string. My code uses the length of the string. (Server
side benefits more from this optimization due to the high volume of
traffic.)
- Numerous improvements to formatting the error message and tools to get the
user's attention.
--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx