Praveen Mitta
Praveen Mitta

Reputation: 1508

Enable Dynamic TextBox with Dynamic checkbox checked event

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

Answers (2)

utsikko
utsikko

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

Hamed
Hamed

Reputation: 2168

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

Upvotes: 0

Related Questions