I am trying to use RangeFieldValidator for a username and password. The username suppose to be at least three characters long and the password at least five characters long. I am using the datatype as string, validating the textbox correctly, but I don't know how to set the minimum and maximum values for the string.
I think I can't use 3 and 5 for the min and max values, since it is string datatype.
I do not use the validators myself, I do not like them because asp.net otuputs js with them and it outputs a bit of invalid code. Here is what I would do, I would put in the script that you are executeing on click of that command button at the bottom, as buntine said, and if statement
if len(yourtextbox) < 3 and len(youtextbox) > 5 then
<code to be executed if the textbox length is how you wanted it>
lblerrormsg would be an asp lable right after your text box.
Text="this feild is required<br>"
Originally posted by talal RangeValidator to use, it looks a good control if I figure out to use in this scenario.
None of the validators are 'good' controls in my opinion. They are bad until version 1.1 if microsoft decides to fix their output. I do not use the built in pageing and some of the other built in features either, because they limit me and output js that does not have a type attribute.