title: How to select particular row in a gridview
body: <p>I have a Gridview </p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" Width="400px" AutoGenerateColumns="false"
              OnSelectedIndexChanged="GridView1_SelectedIndexChanged1"&gt;
              &lt;Columns&gt;
                  &lt;asp:TemplateField&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:CheckBox ID="CheckBox1" runat="server" /&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText="name"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblStudentName" runat="server" Text='&lt;%# Eval("StudentName") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
                  &lt;asp:TemplateField HeaderText="Address"&gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="lblResidentialAddress" runat="server" Text='&lt;%# Eval("ResidentialAddress") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
  
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>and i get the value binded to the gridview</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (!Page.IsPostBack)
      {
  
          DataTable dt = new DataTable();
          dt = objdb.GetData("Getsamples", new object[] { });
          ViewState["CurrentTable"] = dt;
          GridView1.DataSource = dt;
  
          GridView1.DataBind();
  
      }
  }
  
  protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
  {
      Response.Write(GridView1.SelectedRow.Cells[0].Text); 
    //  string selectedText = ((Label)GridView1.SelectedRow.FindControl("lblStudentName")).Text;
  
    //  Response.Write(selectedText);
  }
  </code></pre>
  
  <p>i cannot able to retrive the row where the checkbox is checked...</p>
  
  <p>How to select particular row in a gridview, and based upon the selection i need to take out the 'Name' and pass this as a parameter to get ,another gridview related to the row which i selected.???</p>
  
  <p>any help...</p>