CheckBox chk=new CheckBox();
chk.AutoPostBack = true;
chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
tbcell3.Controls.Add(chk);
tbrow1.Cells.Add(tbcell3);
tbl.Controls.Add(tbrow1);
this.Controls.Add(tbl);
like this the check box was created dynamically now i want to write the code in chk_checkedchanged event
how to write that, i tried like bellow but i didn't get result
void chk_CheckedChanged(object sender, EventArgs e)
{
tbl.BackColor = Color.Black;
}
Jaish MathewsPosted May 19, 2010, 8:51 AM
One more point do all these outside a (!IsPostBack) checking. Then only will work. For each postback these lines need to be executed.
DRISHTYPosted May 19, 2010, 8:34 AM
Add following line while creating checkbox:
chk.CheckedChanged += new System.EventHandler(chk_CheckedChanged);