0

I have CodeBehind

 protected void gvAll_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        KB.DeleteConstant(e.Keys[e.RowIndex]);
        gvMaster.DataBind();
    }

    protected void gvMaster_RowDeleted(object sender, GridViewDeletedEventArgs e)
    {
        Session["MasterBound"] = false;
        gvMaster.DataBind();
    }

and aspx

 onrowdeleted="gvMaster_RowDeleted" 
                            onrowdeleting="gvAll_RowDeleting">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>

                        <asp:TemplateField ShowHeader="False">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                    CommandName="Edit" Text="Edit"/>
                                <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                    CommandName="Delete" Text="Delete"/>
                            </ItemTemplate>

Can someone explain me why onitemdeleted event does not raising when I click Delete?

pincet
  • 103
  • 2
  • 2
    You are using DataBind() on RowDeleting event also which will be initializing your gridview again. – haraman Oct 14 '15 at 06:03
  • Do you want to delete data from database or from datatable only? you have to run delete command for Deleting row from gridview and then binddata again. This http://stackoverflow.com/questions/7226548/how-to-delete-row-in-gridview-using-rowdeleting-event will help you. – Rojalin Sahoo Oct 14 '15 at 06:14

0 Answers0