title: how to select the row id on button click event inside gridview
body: <p>I have added the two button in my gridview..
  where data gets loaded in grid view on page load event .. 
  now i want to write the update and delete query on add and delete button respectively.
  My question is how to select the row id on button click event</p>
  
  <pre><code> &lt;asp:GridView ID="GridView1" runat="server" CssClass="flat-table flat-table-1"&gt;
     &lt;Columns&gt;
     &lt;asp:TemplateField&gt;
         &lt;ItemTemplate&gt;
             &lt;asp:Button ID="btn_add" runat="server" CommandName="Add" OnClick="btn_add_Click" Text="Add" CssClass="btn btn-align btn-primary" /&gt;
               &lt;asp:Button ID="btn_cancel" runat="server" CommandName="Cancel" OnClick="btn_cancel_Click" Text="Delete" CssClass="btn btn-align btn-danger" /&gt;
          &lt;/ItemTemplate&gt;
     &lt;/asp:TemplateField&gt;
   &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>