Hi All
this is my page load event
this is my code
but CheckBox_Checke dChanged event not working
pls help
this is my page load event
Code:
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i <= 3; i++)
{
TableRow tr = new TableRow();
TableCell td1 = new TableCell();
td1.Text = "1";
TableCell td2 = new TableCell();
td2.Text = "2";
tr.Cells.Add(td1);
tr.Cells.Add(td2);
Table1.Rows.Add(tr);
TableRow tr2 = new TableRow();
TableCell td3 = new TableCell();
td3.ColumnSpan = 2;
CheckBox chk = new CheckBox();
chk.ID = Convert.ToString(i);
chk.CheckedChanged += new EventHandler(CheckBox_CheckedChanged);
td3.Controls.Add(chk);
tr2.Cells.Add(td3);
Table1.Rows.Add(tr2);
}
}
protected void CheckBox_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = sender as CheckBox;
Label1.Text = chk.Checked ? String.Format("You checked CheckBox '{0}'.", chk.ID) : String.Format("You unchecked CheckBox '{0}'.", chk.ID);
//Label1.Visible = true;
}
but CheckBox_Checke dChanged event not working
pls help
Comment