title: How to check that Dynamically created checkbox checked or not?
body: <p>I've created some dynamic checkboxes in table header row.</p>
  
  <p>If the checkbox is checked , table will have another row with a textbox.</p>
  
  <p>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 :</p>
  
  <p>Object Reference not set to an instance of an object.</p>
  
  <p>Here is my code :</p>
  
  <p>Creating Dynamic controls here :</p>
  
  <pre><code> TableRow thead = new TableRow();
   for (int i = 0; i &lt; 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);
  </code></pre>
  
  <p>Checkbox checked changed event :</p>
  
  <pre><code>public void Chk_Fund_CheckedChange(object sender, EventArgs e)
  {
       TableRow tr = new TableRow();
       for (int i=0;i&lt;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";
  }
  </code></pre>
  
  <p>The event is firing very well , but when I check that the checkbox is checked or not there's an exception.</p>
  
  <p>How can I resolve this problem ? Kindly Help me Please</p>