CompareValidator error when value between 3 and 10

790 views Asked by At

I have problem with CompareValidator. I need to validate input1 such that it is less than or equal to "Somepercentage" from database. The control keep showing error message when input1 is between 3-10 even when it is less than "Somepercentage". When input1 is more than 10, it works fine.

<asp:CompareValidator ID="Validator" runat="server" ErrorMessage="CompareValidator"  valueToCompare='<%# Eval("Somepercentage")%>' ControlToValidate="input1" Operator="LessThanEqual"></asp:CompareValidator>
1

There are 1 answers

0
vasin1987 On BEST ANSWER

I found the solution. add type="Double" into asp:comparevalidator tag.

CompareValidator does not work with single digit