473,796 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CompareValidato r not working where a RangeValidator is

The range validator works, the compare validator doesn't.

Dim txbNew As New TextBox
txbNew.ID = "txb" & arStyles(i)

Dim rvNew As New RangeValidator
rvNew.Text = "Must be a number greater then 0"
rvNew.ControlTo Validate = "txb" & arStyles(i)
rvNew.EnableCli entScript = False
rvNew.MinimumVa lue = 1
rvNew.MaximumVa lue = 1000

Dim cvNew As New CompareValidato r
cvNew.Text = "Must be a number greater then 0"
cvNew.ControlTo Validate = "txb" & arStyles(i)
cvNew.EnableCli entScript = False
cvNew.Operator = ValidationCompa reOperator.Data TypeCheck
cvNew.Type = ValidationDataT ype.Integer

tdBox.Controls. Add(txbNew)
tdBox.Controls. Add(cvNew)
tdBox.Controls. Add(rvNew)

Nov 19 '05 #1
3 3036
Set the validator's Type to be ValidationDataT ype.Integer (or Double).

-Brock
DevelopMentor
http://staff.develop.com/ballen
The range validator works, the compare validator doesn't.

Dim txbNew As New TextBox
txbNew.ID = "txb" & arStyles(i)
Dim rvNew As New RangeValidator
rvNew.Text = "Must be a number greater then 0"
rvNew.ControlTo Validate = "txb" & arStyles(i)
rvNew.EnableCli entScript = False
rvNew.MinimumVa lue = 1
rvNew.MaximumVa lue = 1000
Dim cvNew As New CompareValidato r
cvNew.Text = "Must be a number greater then 0"
cvNew.ControlTo Validate = "txb" & arStyles(i)
cvNew.EnableCli entScript = False
cvNew.Operator = ValidationCompa reOperator.Data TypeCheck
cvNew.Type = ValidationDataT ype.Integer
tdBox.Controls. Add(txbNew)
tdBox.Controls. Add(cvNew)
tdBox.Controls. Add(rvNew)


Nov 19 '05 #2
Thanks Brock, if you looked at the code you would see that it is there
- cvNew.Type = ValidationDataT ype.Integer

Nov 19 '05 #3
But rvNew does not. Type in 01 into the range validator and see if it still
works.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thanks Brock, if you looked at the code you would see that it is there
- cvNew.Type = ValidationDataT ype.Integer


Nov 19 '05 #4

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

Similar topics

5
17332
by: charliewest | last post by:
I've configured a RangeValidator control on a WebForm, using ASP.NET, and have set the type to string, the max value to 100, and min value to 1, however, the control to validate always throws an error, regardless of the length of the string. For example... <asp:textbox id="txtQuestion" runat="server" Width="400px" MaxLength="100" Height="50px" TextMode="MultiLine" CssClass="text1"></asp:textbox> <asp:RangeValidator...
2
3198
by: Eric Maia | last post by:
I have a textbox (StartDateTextBox) in a UserControl on my page, that is supposed to have a date entered into it. I have a RequiredFieldValidator that has its ControlToValidate property set to the textbox. I also have a CompareValidator pointed to the textbox with its Type="Date." Despite all documentation to the contrary, I am getting an exception when the page first loads that is thrown by the CompareValidator, complaining that it...
6
2693
by: jk | last post by:
Looking through WebUIValidation.js, I discovered that the standard validators don't cater for non-numeric date formats (e.g. dd-MMM-yyyy) which I would like to do To keep code to a minimum, I would like to extend the existing validator to handle other common date formats and still be able to do both client and/or server side validation as normal. Unfortunately, I am unable to get the extended code to ever be called I implemented the...
2
4394
by: Lucas Tam | last post by:
Hi all, I have a RangeValidator that is not working correctly - it is always returning a isValid = False. The Javascript is returning this as well as on the server side. My RangeValidator validators a control called CampaignID. In the debugger I've verified there is a control called CampaignID and there is a valid set .... however the RangeValidator still returns not valid.
3
9533
by: CyberLotus | last post by:
Hi, I wish to validate the date a user has entered against the format dd-mmm-yyyy using the CompareValidator, but it does not work. Does anybody have a simple solution please? Many thanks in advance.
11
2179
by: Axel Dahmen | last post by:
Hi, I'm working in a team developing an international website. When I set the page's CultureInfo to Hungarian (hu-HU) then the RangeValidator doesn't seem to be able to parse a TextBox's date value (Exception message see below) correctly. The TextBox's value is coming from the DateTime.Now.ToShortDateString() function, so it's an original .NET value.
0
985
by: Groove | last post by:
I have a form that has several fields which accept integers. These fields are mileage fields so the value in the fields is easily in the hundreds of thousands. Ex: 152,750. The form loads existing data and lets users update it. When the form loads the data, I format it in the field as a "number" to make it easier to read like so: decMileage = drItemData("TotalMileage") txtMileage.Text = decMileage.ToString("n0")
1
2287
by: Cirene | last post by:
Here's my RangeValidator <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtSVDV" ErrorMessage="RangeValidator" MaximumValue="0" MinimumValue="-100" Type="Double">Make it < 0</asp:RangeValidator></td> My value for txtSVDV is ".015" and the validator is invoking. Any idea why? I have the type set to Double. Thanks!
0
1272
by: Andrew Han | last post by:
I have a simple textbox where a user can enter a numeric value. The RangeValidator works perfectly well to determine if the value is a number of whatever type I specify AND to determine if the value sits between the min and max values I specify. However, if the user enters a valid number within the specified range, but enters it in scientific notation, the RangeValidator doesn't recognize it as a valid number.
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10168
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.