The GridView ‘gv1′ fired event RowDeleting which wasn’t handled

Hi Friends,

Today, i will discuss about gridview delete command event which returns error sometime like “The GridView ‘gv1′ fired event RowDeleting which wasn’t handled.” and why they return it??

see the below code where I have used delete image button in gridview template field. I have also defined event for OnRowCommand in gridview.



................................
................................
................................
................................









................................
................................
................................
................................



Here is what I am doing in the code-behind:

 protected void gv1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("DELETE"))
        {
           .........
           .........

           Operation related to deleting record from gridview and binding record to gridview

           .........
           .........

        }
    }

I am getting below error after clicking on delete button:
gv_deletee

Here is reason for error :-
I am assuming the delete button is in a datagrid. Since the name is ‘delete’, that’s a reserved name and it will trigger the deleting event.

Solution For This Error :-
Either change the name or add a dummy RowDeleting handler.

I have changed the command name of button from “DELETE” to “DELETEITEM” abd it solves the error.

Hope this will help !!!…

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>