I've created some dynamic checkboxes in table header row.

If the checkbox is checked , table will have another row with a textbox.

Checkbox changed event is firing very well but when I'm trying to check whether the checkbox is checked or not , it's generating exception :

Object Reference not set to an instance of an object.

Here is my code :

Creating Dynamic controls here :

```
 TableRow thead = new TableRow();
 for (int i = 0; i < dt_fundtype.Rows.Count; i++)
 {
     TableCell td = new TableCell();
     CheckBox chk = new CheckBox();
     chk.ID = "fund_" + dt_fundtype.Rows[i]["fund_type_cd"];
     chk.Text = dt_fundtype.Rows[i]["fund_type"].ToString();
     chk.AutoPostBack = true;
     chk.CheckedChanged += new EventHandler(Chk_Fund_CheckedChange);
     td.Controls.Add(chk);
     thead.Cells.Add(td);
 }
 tbl_fundtype.Rows.Add(thead);

```

Checkbox checked changed event :

```
public void Chk_Fund_CheckedChange(object sender, EventArgs e)
{
     TableRow tr = new TableRow();
     for (int i=0;i<tbl_fundtype.Rows[0].Cells.Count;i++)
     {
         string DynamicChkID ="fund_"+ dt_fundtype.Rows[i]["fund_type_cd"].ToString();
         CheckBox chk = new CheckBox();
         chk = (CheckBox)tbl_fundtype.Rows[0].Cells[i].FindControl("DynamicChkID");
         if (chk.Checked == true)//Here is the Exception
         {
             TableCell td = new TableCell();
             td.Text = "Test";
             tr.Cells.Add(td);
         }
     }

     tbl_fundtype.Rows.Add(tr);
     hfTab.Value = "fund";
     collapsestate = "expand";
}

```

The event is firing very well , but when I check that the checkbox is checked or not there's an exception.

How can I resolve this problem ? Kindly Help me Please