title: hide row on clicking delete link in gridview
body: <p>I have a gridview, in which two link buttons are there.
  Here it is:</p>
  
  <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" PageSize="5" OnRowCommand="gv_RowCommand" 
                          AllowPaging="true" DataKeyNames="ID" CssClass="mGrid"  BackColor="White" BorderColor="Silver" BorderStyle="Double"
                          BorderWidth="1px" CellPadding="4" &gt;
  
           &lt;RowStyle BackColor="White" Width="150%" ForeColor="#003399" /&gt;
              &lt;Columns&gt;
                  &lt;asp:TemplateField HeaderText="ID" Visible="false" &gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblID"  Text='&lt;%#Bind("ID") %&gt;' runat="server"&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField  HeaderText="Version"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblversion" Text='&lt;%#Bind("version") %&gt;' runat="server"&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="Image ID"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblimageid" runat="server" Text='&lt;%#Bind("image_id") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="Getty ID"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblgettyid" runat="server" Text='&lt;%#Bind("getty_id") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                      &lt;%--&lt;EditItemTemplate&gt;
                                      &lt;asp:TextBox ID="txtgettyid" Text='&lt;%#Bind("getty_id") %&gt;' runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;/EditItemTemplate&gt;--%&gt;
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="Pool Letter"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblpoolletter" runat="server" Text='&lt;%#Bind("pool_letter") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="To Use"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lbltouse" runat="server" Text='&lt;%#Bind("to_use") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
                     &lt;%-- &lt;EditItemTemplate&gt;
                                      &lt;asp:TextBox ID="txttouse" Text='&lt;%#Bind("to_use") %&gt;' runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;/EditItemTemplate&gt;--%&gt;
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="Clue"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblclue" runat="server" Text='&lt;%#Bind("clue") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="Range"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblrange" runat="server" Text='&lt;%#Bind("range") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="last_updated"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lbllastupdated" runat="server" Text='&lt;%#Bind("last_updated") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="Status"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblstatus" runat="server" Text='&lt;%#Bind("status") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField  HeaderText="First"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblfirst" runat="server" Text='&lt;%#Bind("first") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="Middle"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lblmiddle" runat="server" Text='&lt;%#Bind("middle") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
                  &lt;asp:TemplateField HeaderText="Last"&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:Label ID="lbllast" runat="server" Text='&lt;%#Bind("last") %&gt;'&gt;&lt;/asp:Label&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
                   &lt;asp:TemplateField &gt;
                   &lt;ItemStyle Wrap="false" Width="100px" /&gt;
                      &lt;ItemTemplate&gt;
                                      &lt;asp:LinkButton ID="lnkbtnedit" Text="Edit" Visible="true" style="color:#006699;"  CommandName="Edit" runat="server"&gt;&lt;/asp:LinkButton&gt;
                        &amp;nbsp;&amp;nbsp; &lt;asp:LinkButton ID="lnkbtndel" Text="Delete" Visible="true"  style="color:#006699;"  CommandName="Delete" runat="server"&gt;  &lt;/asp:LinkButton&gt;
                      &lt;/ItemTemplate&gt;
  
                  &lt;/asp:TemplateField&gt;
  
  
  
  
              &lt;/Columns&gt;
                &lt;PagerStyle BackColor="#006699" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" /&gt;
                          &lt;AlternatingRowStyle BackColor="#CCFFFF" /&gt;
                          &lt;SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" /&gt;
                          &lt;HeaderStyle  BackColor="#006699" Font-Bold="True" ForeColor="White"  /&gt;
      &lt;/asp:GridView&gt;
  
  
  
  
  
  
  
  
  
  void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
          {
              GridViewRow row = GridView1.Rows[e.RowIndex];
  
              int ID = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value);
  
              con = new SqlConnection(conString);
              con.Open();
              int v = version + 1 ;
  
              string updatedetails = "update tblfameface set status ='Deleted',version=" + v + "  where ID=" + ID + " ";
              SqlCommand cmd = new SqlCommand(updatedetails, con);
              int temp = cmd.ExecuteNonQuery();
              con.Close();
  
              //int rows = GridView1.CurrentCell.RowIndex;
              //GridView1.Rows.RemoveAt(rows);
  
              bindDB();
  
              LinkButton btndel = (LinkButton)GridView1.Rows[row.RowIndex].FindControl("lnkbtndel");
              btndel.Visible = false;
  
          }
  </code></pre>
  
  <p>On clicking Edit link,it is working as desired and 
  When I click on Delete link, I want that row to be hidden.
  which event should be fired and how can it be handled?
  how can I achieve this??</p>