title: How to get values of CheckBoxes inside a gridview that are checked using asp .net
body: <p>I am using checkbox in gridview .... I am using it in 1st cell.... When I select the checkbox at run time, I need to get those values... but on selecting or on click to checkbox, it's not finding or value is taking as FALSE... how to write in asp.net backend and in c# code?</p>
  
  <pre><code> &lt;asp:TemplateField&gt;
     &lt;ItemTemplate &gt;
         &lt;asp:checkbox id="ShowAddress" runat="server" /&gt;
    &lt;/ItemTemplate&gt;
   &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>Code-behind:</p>
  
  <pre><code>  protected void Button1_Click(object sender, EventArgs e)
      {
          // Looping through all the rows in the GridView
  
          foreach (GridViewRow di in GridView1.Rows)
          {
           CheckBox chkBx = (CheckBox)di.FindControl("ShowAddress");
  
              if (chkBx != null &amp;&amp; chkBx.Checked)
              {
                  /// put your code here
              }
          }
      }
  </code></pre>
  
  <p>Is there any implementation to be  done in script at page load?</p>
  
  <p>Can anyone help?</p>