I found the solution. add type="Double" into asp:comparevalidator tag.
CompareValidator error when value between 3 and 10
-
21-09-2022 - |
Question
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>
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow