1

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

2 Answers 2

4

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;
}
Sign up to request clarification or add additional context in comments.

2 Comments

Or just TextBox1.Enabled = TextBox1.Enabled;
Thanks For you quick reply. I have been using the above code but because of update panel that i am using on my page. I was unable to achieve that. But anyways i figured it out. Thanks again.
0

in the check event that you want to enable textbox2 just use
textbox1.enabled = true;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.