Author: bspahr | Posted on: 12/4/2010 6:32:43 PM | Views : 628

I have a checkbox and a textbox. When the checkbox is checked I want make the textbox required.
I tried what's below but it is not working.
<asp:CheckBox ID="chkSubmit" runat="server" oncheckedchanged="chkSubmit_CheckedChanged" /> Email: <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="valtxtEmail" runat="server" ControlToValidate="txtEmail" SetFocusOnError="true" ErrorMessage="Required" Enabled="False"></asp:RequiredFieldValidator>




protected void chkSubmit_CheckedChanged(object sender, EventArgs e) { valtxtEmail.Enabled = true; }

...

Go to the complete details ...