Click here to Skip to main content
15,922,015 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,



I am using the compare validator in my form to check the value is greater than zero. In my form I will select the dropdown it contains the value "yes"and "NO" when I am selecting NO I will hide the salary text box I have set the compare validator for this salary text box. When I am saving the values are saving in the database and a message box will display as "Data saved succesfully". When I click the OK button I will fill the Forms once again for viewing the saved data at that time the compare validator for the hidden field is displaying the error message. How to hide this message. Can anyone help me to solve this problem. Here is the code for compare validator:

ASP.NET
<asp:CompareValidator ID="cmpEMDValue" runat="server" CssClass="css_Validation"
        ControlToValidate="txtSalary"
        ErrorMessage="The Salary must be greater than zero"
        Operator="GreaterThan" SetFocusOnError="true"
        ValueToCompare="0"></asp:CompareValidator>



Thanks in advance.
Posted
Updated 28-Sep-11 22:26pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900