rcowen00
asked on
CompareValidator Problem
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
This is the textboxes
This is my compare validator
<asp:CompareValidator ID="CompareValidator9" runat="server"
ControlToCompare="txtCapacity" ControlToValidate="txtMaxCapacity"
ErrorMessage="CompareValidator" Operator="GreaterThanEqual" Type="Integer"></asp:CompareValidator>
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>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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???
ASKER
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
ASKER