why is my range validator failing?

D

Darrel

I have this range validator:

<asp:rangevalidator id=RngVal_LGwidth runat="server" ErrorMessage="LG Width
needs to be between 10px and 2000px" EnableClientScript="False"
ControlToValidate="tbx_LGwidth" MaximumValue="1999" MinimumValue="10"
Display="Dynamic">(!)</asp:rangevalidator>

For some reason, it's triggering when my text box has a value of '200' or
higher (rather than 2000).

Why?

-Darrel
 
T

Teemu Keiski

You also need to specify the type of the data for it. Otherwise it is
assumed to be a string, and string evaluation is quite different from
evaluating numbers...

Specify additionally

Type="Integer" to the control declaration
 
D

Darrel

There is no type set. Try adding type="Integer" somewhere in there. I
think it defaults to string which doesn't make much sense. I haven't
ever needed to validate the range of a string...

Ah! Right in front of me. Thanks!

Yea, that *is* weird...how does one even check the range of a string?

-Darrel
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top