title: linkButton Click Event in Grid View not firing when adding though Bound Fields in a loop in GridView
body: <p>Hi,Here i am trying to implement the linkButton click event in a
  gridview through code behind using the BoundField Class in gridview.
  when i trying to add the individual BoundField values Directly to grid
  as a column in page_Load and binding the linkbutton in
  RowDataBoundEvent of the row of cell with linkbutton click event, it
  is firing the linkButton Click event well with the following code.</p>
  
  <pre><code>protected void Page_Load(object sender,EventArgs e)
  {
  
            BoundField bfield = new BoundField();
             bfield.HeaderText = "EmpName";
             bfield.DataField = "EmpName";
             gridView.Columns.Add(bfield);
  
             BoundField bfield1 = new BoundField();
             bfield1.HeaderText = "Monday";
             bfield1.DataField = "Monday";
             gridView.Columns.Add(bfield1);
  }
  </code></pre>
  
  <p>and in on RowDataBound Event i have wrote</p>
  
  <pre><code>protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
      {
          if (e.Row.RowType == DataControlRowType.DataRow)
          {
              LinkButton lnkViews = new LinkButton();
              lnkViews.ID = "lnkViews";
              lnkViews.Text = (e.Row.DataItem as DataRowView).Row["Monday"].ToString();
              lnkViews.Click += new EventArgs(linkButton_ClickAction);
              e.Row.Cells[2].Controls.Add(lnkViews);
  
  
          }
      }
  
  protected void linkButton_ClickAction(object sender, EventArgs e)
   {
   LinkButton lnkView = (sender as LinkButton); 
  GridViewRow row = (lnkView.NamingContainer as GridViewRow); 
  string id = lnkView.CommandArgument; 
  string name = row.Cells[0].Text; this.ModalPopupExtender1.Show();
   }
  </code></pre>
  
  <p>But when i trying to add the above BoundFields by looping based on the
  table columns count like this, in page_Load event, the event is not
  firing.</p>
  
  <pre><code>protected void Page_Load(object sender,EventArgs e)
  { 
  DataTable dtTable = new DataTable();
  
             dtTable= BindGrid();
  
             BoundField boundField;
             for (int i = 0; i &lt; dtTable.Columns.Count; i++)
             {
                 string ColumnValue = dtTable.Columns[i].ColumnName;
                  boundField = new BoundField();
                  boundField.HeaderText = ColumnValue;
                  boundField.DataField = ColumnValue;
                  gridView.Columns.Add(boundField);
             }
  }
  </code></pre>
  
  <p>when we creating the BoudnField event using the above code in a loop
  based on dataSource columns count, it doesn't firing linkbutton event. why?</p>