473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

why is my range validator failing?

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
Apr 17 '06 #1
3 1680
Hi 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...

http://msdn2.microsoft.com/en-us/lib...pe(VS.80).aspx

--
David Hogue
Darrel wrote:
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).

Apr 17 '06 #2
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

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Darrel" <no*****@nospam.com> wrote in message
news:e6**************@TK2MSFTNGP05.phx.gbl...
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

Apr 17 '06 #3
> 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
Apr 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Antho | last post by:
Hello NG Sorry if this is the wrong NG to post this in. I have installed Apache2 and PHP on my Mdk 9.2 box. I have made an info.php page to test if php is working. It appears that it is as my...
4
by: Fraggle | last post by:
Hi, I want to validate a text box, The user can leave it blank, or fill it in. If they fill it in then it must be a date within a certain range. How can I achieve this? Thank you very much
1
by: tshad | last post by:
I have been trying to set up a range validator and regular expression for my dates. I tried this: <asp:RangeValidator runat="server" ControlToValidate="AbsentFrom1" MinimumValue="12/31/1950"...
3
by: Joey | last post by:
I have a page with a range validator on it. I have the following set... ControlToValidate=txtSomeTextBox MinimumValue=1 MaximumValue=2000 Now, when I run the form, the values 1,2,10 all pass...
1
by: MattB | last post by:
I have a page with dual controls for a person to enter their height and weight. The dual controls are for English and metric units, and Javascript onChange events handle populating the other...
2
by: Tarun Mistry | last post by:
Hi everyone, i have a range validator set to date mode. However, I want the max date to be whatever it is right now, is there a way of setting this within the properties of the range validator? ...
0
by: Toco | last post by:
Hello. I have two calendar controls and wish to validate the timespan difference between them. Can this be accomplished using a range validator? Currently I'm validating the timespan on the...
0
by: beasers | last post by:
Hi I can't find any other examples of this, but I have a simple text box with an accompanying range validator set to Min 0 and Max 99999. The validation works if I enter an illegal character...
15
by: chicane | last post by:
I am using VS2008 and I trying to use the Range Validator for the following: I have a text box that a user will input a date into for an appointment - the date entered must be at least 7 days...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.