title: How to get gridview column value in codebehind
body: <p>How to get the AppId from  gridView in codebehind, if I clicked the edit image button in second row.</p>
  
  <p><img src="https://i.stack.imgur.com/p2Auu.png" alt="Application List"></p>
  
  <p><strong>Aspx Code:</strong></p>
  
  <pre><code>&lt;asp:BoundField HeaderText="AppId" DataField="AppID" /&gt;
  
  
  &lt;asp:TemplateField HeaderText="Actions" ControlStyle-Width="20px" ItemStyle-Width="130px"&gt;
                      &lt;ItemTemplate&gt;
                        &lt;asp:ImageButton ID="imgMailCamp" runat="server" ImageUrl="~/Images/AppSetup/Mail.png"
                              Height="18px" ToolTip="Send Mail Campaign" CssClass="grdImageAlign"  CommandName="SendMail" OnClick="btnMailCamp_Click"    /&gt;
                          &lt;asp:ImageButton ID="imgViewApp" runat="server" ImageUrl="~/Images/AppSetup/application-view-list-icon.png"
                              Height="18px" ToolTip="View Appplication" CssClass="grdImageAlign" CommandName="View" OnClick="btnView_Click" /&gt;
                          &lt;asp:ImageButton ID="imgEditApp" runat="server" ImageUrl="~/Images/AppSetup/Action-edit-icon.png"
                              Height="18px" ToolTip="Edit Application" CssClass="grdImageAlign" CommandName="Edit" OnClick="btnEdit_Click"/&gt;
                          &lt;asp:ImageButton ID="imgDeleteApp" runat="server" ImageUrl="~/Images/AppSetup/Trash-can-icon.png"
                              Height="18px" ToolTip="Delete Application" CssClass="grdImageAlign" CommandName="Delete" OnClick="btnDelete_Click" /&gt;
                     &lt;/ItemTemplate&gt;
                  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p><strong>C# Code:</strong></p>
  
  <pre><code>protected void btnEdit_Click(object sender, EventArgs e)
  {
     // I need to get the current row appId, I use this appId in next page for sql query
    Response.Redirect("/Secured/EditApplication.aspx?AppID="+AppID);
  }
  </code></pre>