Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CompareValidator Problem

Posted on 2012-03-16
5
Medium Priority
?
243 Views
Last Modified: 2012-03-22
I'm sure this is a simple mistake but I have a CompareValidator that appears to be comparing the values within the text boxes as String vs Integers.  When I enter 3 in the txtCapacity and 15 in txtMaxCapacity the validation is triggered as an error.  What am I doing wrong.  Thanks!

This is my compare validator
<asp:CompareValidator ID="CompareValidator9" runat="server" 
                         ControlToCompare="txtCapacity" ControlToValidate="txtMaxCapacity" 
                         ErrorMessage="CompareValidator" Operator="GreaterThanEqual" Type="Integer"></asp:CompareValidator>

Open in new window


This is the textboxes
<td>Daily Capacity:*</td>
                            <td>
                                <asp:TextBox runat="server" ID="txtCapacity" MaxLength="3" Columns="10" 
                                    Width="201px" />
                            </td>
                        </tr> 
                          <tr>
                            <td>Max Open Capacity:*</td>
                            <td>
                                <asp:TextBox runat="server" ID="txtMaxCapacity" MaxLength="3" Columns="10" 
                                    Width="201px" />
                            </td>

Open in new window

0
Comment
Question by:rcowen00
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 1000 total points
ID: 37731569
When you say "Operator='GreaterThanEqual'" you are indicating you want txtCapacity's value to be greater than or equal to txtMaxCapacity's value. Try switching to "Operator='LessThanEqual'".
0
 

Author Comment

by:rcowen00
ID: 37731848
Switched it and I get the same thing
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 1000 total points
ID: 37733824
>ControlToCompare="txtCapacity" ControlToValidate="txtMaxCapacity"

Aren't those wrong way around?
0
 

Author Comment

by:rcowen00
ID: 37736176
I have tried mixing it up every which way.  It will validate as expected if I enter txtCapacity=4 and txtMaxCapacity=5 but if I enter txtCapacity=4 and txtMaxCapacity=12 then it triggers it as txtMaxCapacity is less than txtCapacity.  I have even tried setting up a custom validator but I get the same results.  Am I inadvertently assigning the field as text and not realizing it???
0
 

Author Closing Comment

by:rcowen00
ID: 37754832
The problem was caused by 2 validation tags and one was correct and the other incorrect.  Once I removed the incorrect one everything fired correctly
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question