Reputation: 1508
I am adding 2 controls Checkbox1 and Textbox1 dynamically. Textbox1 has been disabled by default. I want to enable Textbox1 if checkbox1 is checked. Thanks in Advance.
Praveen
Upvotes: 1
Views: 1565
Reputation: 1545
Your code with both controls, should be something like:
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox1.Checked)
TextBox1.Enabled = true;
else
TextBox1.Enabled = false;
}
Upvotes: 4
Reputation: 2168
in the check event that you want to enable textbox2 just use
textbox1.enabled = true;
Upvotes: 0