title: Get ID in GridView from checkBox
body: <p>I have the following GridView -</p>
  
  <pre><code>&lt;ItemTemplate&gt;
  
           &lt;asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="checkButton_OnClick"  AutoPostBack="true"/&gt;
  
       &lt;/ItemTemplate&gt;
  
    &lt;/asp:TemplateField&gt;
  
          &lt;asp:BoundField HeaderText="tID" DataField="tID" 
                          SortExpression="tID" HeaderStyle-CssClass = "hideGridColumn" ItemStyle-CssClass="hideGridColumn"&gt;&lt;/asp:BoundField&gt;
          &lt;asp:BoundField HeaderText="Name" HeaderStyle-HorizontalAlign=Center DataField="NAME" 
                          SortExpression="NAME" ItemStyle-HorizontalAlign=Center&gt;&lt;/asp:BoundField&gt;
  
      &lt;/Columns&gt;
  </code></pre>
  
  <p>Then find the rows where the checkBoxes are checked by -</p>
  
  <pre><code> foreach (GridViewRow gvr in table_example.Rows)
          {
              if (((CheckBox)gvr.FindControl("CheckBox1")).Checked == true)
              {
                  //Here I need the tID of the row that is checked
  
  
                  WebService1 ws = new WebService1();
                  ws.addID(tID);
              }
          }
  </code></pre>
  
  <p>I need to acquire the <code>tID</code> of the checked row, I tried -</p>
  
  <pre><code>int tID = gvr.cells["tID"];
  </code></pre>
  
  <p>However this did not work.</p>