title: Selecting Particular Column in a Gridview
body: <p>I have a gridview in which there are multiple records i am showing. On a page load event, i am retrieving data from database and populate the gridview. I have another column for edit and delete which are Imagebuttons. Now i want when a user click on edit button, then on the bases of Id (of that row upon a user clicked),he/she redirects to another webform with the selected Id and then that person records loads from database and populate the corresponding textboxes. I am not updating records within Gridview.
  Here is the image for clear understandings
  <a href="https://i.stack.imgur.com/8ADoF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8ADoF.jpg" alt="enter image description here"></a> </p>
  
  <p>Here is my .aspx code</p>
  
  <pre><code>&lt;asp:GridView ID="dgvEmployeesInformation" runat="server" CssClass=" table table-bordered table-hover table-responsive" AutoGenerateColumns="false" OnRowCommand="dgvEmployeesInformation_RowCommand"&gt;
                  &lt;%--1st Column--%&gt;
                  &lt;Columns&gt;
                      &lt;asp:BoundField  HeaderText="ID" DataField="Id" ShowHeader="false" Visible="false" ControlStyle-BackColor="#0066ff"/&gt;
                      &lt;asp:BoundField  HeaderText="Name" DataField="Name"/&gt;
                      &lt;asp:BoundField  HeaderText="Employee No" DataField="EmployeeNo"/&gt;
                      &lt;asp:BoundField  HeaderText="Father Name" DataField="FatherName"/&gt;
                      &lt;asp:BoundField  HeaderText="CNIC" DataField="CNIC"/&gt;
                      &lt;asp:BoundField  HeaderText="Contact No" DataField="ContactNo"/&gt;
                      &lt;asp:BoundField  HeaderText="City" DataField="City"/&gt;
                      &lt;asp:BoundField  HeaderText="Post" DataField="RecommendedPost"/&gt;
                      &lt;asp:BoundField  HeaderText="Status" DataField="Status"/&gt;
                      &lt;asp:BoundField  HeaderText="Degree Status" DataField="DegreeStatus"/&gt;
                      &lt;asp:TemplateField HeaderText="Action"&gt;
                          &lt;ItemTemplate&gt;
                              &lt;asp:ImageButton ImageUrl="~/Images/edit.png" CommandName="Edit" Text='&lt;%# Eval("ID") %&gt;' ToolTip="Edit" Width="20px" Height="20px" runat="server"/&gt;
                              &lt;asp:ImageButton ImageUrl="~/Images/delete.png" CommandName="Delete" Text='&lt;%# Eval("ID") %&gt;' ToolTip="Delete" Width="20px" Height="20px" runat="server"/&gt;
                          &lt;/ItemTemplate&gt;
                      &lt;/asp:TemplateField&gt;
                  &lt;/Columns&gt;
              &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Here is .aspx.cs Code</p>
  
  <pre><code> protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              dgvEmployeesInformation.DataSource = GetData();
              dgvEmployeesInformation.DataBind();
          }
      }
  
      private DataSet GetData()
      {
          DataSet DS = new DataSet();
          using (SqlConnection con = new SqlConnection(Base.GetConnection))
          {
  
              SqlDataAdapter ad = new SqlDataAdapter("spSelectEmployeeSpecificRecord", con);
              ad.SelectCommand.CommandType = CommandType.StoredProcedure;
              ad.Fill(DS);
          }
          return DS;
      }
  protected void dgvEmployeesInformation_RowCommand(object sender, GridViewCommandEventArgs e)
      {
          if (e.CommandName.Equals("Edit"))
          {
  
          }
      }
  </code></pre>
  
  <p>I have no idea how to get ID of the selected row and send it to another page. Please Help</p>