View Full Version : How to prevent validation on textbox control

05-14-2011, 10:46 PM
I have this:

<asp:TextBox ID="QueryTxt" runat="server" asp:TextBox> <asp:RequiredFieldValidator Display="Dynamic" ID="RequiredFieldValidator2" runat="server" ErrorMessage="Error 2" ControlToValidate="QueryTxt"></asp:RequiredFieldValidator>
<asp:CheckBox ID="MyCheckBox" Text="Get Text only" runat="server" />

As you see I have a textbox, but when I click on the checkbox I want the the validaton of the textbox to be ignored. Is this possible? I have tried to use causesvalidation ="false" on the textbox but it doesnīt work. I donīt want to use causesvalidation on the button-control because in some cases I need to validate the textbox and in some, I dont - depends on Checkbox. Is this possible?