title: How to get selected rows values using check box in GridView asp.net?
body: <p>I am unable to get row values in Grid by checking check box. selected check box is always getting false in code behind. Please help me to solve this problem. Thanks in advance</p>
  
  <p>This is my aspx code:</p>
  
  <pre><code>&lt;asp:GridView ID="resumeSearchGrid" DataKeyNames="CandidateID"  CellPadding="5" runat="server" Width="100%" AutoGenerateColumns="false"&gt;
      &lt;Columns&gt;
          &lt;asp:TemplateField&gt;
              &lt;ItemTemplate&gt;
                  &lt;asp:CheckBox ID="chkSelect" runat="server"/&gt;
              &lt;/ItemTemplate&gt;
          &lt;/asp:TemplateField&gt;
          &lt;asp:BoundField DataField="CandidateID" HeaderText="CandidateID" Visible="false" /&gt;
          &lt;asp:BoundField DataField="CandidateName" HeaderText="Name" /&gt;
          &lt;asp:BoundField DataField="EmailID" HeaderText=" Email Id" /&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  &lt;asp:Button ID="Button1" class="button"  runat="server" 
  Text="Send to client" onclick="Button1_Click"&gt;&lt;/asp:Button&gt;
  </code></pre>
  
  <p>This is my code behind :</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      foreach (GridViewRow gvrow in resumeSearchGrid.Rows)
      {
          CheckBox chk = (CheckBox)gvrow.FindControl("chkSelect");
  
          if (chk != null &amp;&amp; chk.Checked)
          {
              Name += resumeSearchGrid.DataKeys[gvrow.RowIndex].Value.ToString() + ',';
              eMail += gvrow.Cells[2].Text + ',';
          }
      }
  }
  </code></pre>