Solving GridView error "event RowDeleting was not handled"

When doing delete operations in a GridView in ASP.Net gives the error "The GridView event RowDeleting wasn't handled" could be encountered by the developer.

Normally we creat a RowDeleting event to overcome this error.

But the question is why this error occurred?

The answer is that when you are trying to delete a row using a RowCommand event with a command name of delete for your delete button GridView itself finds that a Row_Deleting event is going to be called and waits for it but we haven't created it so the error is thrown when deleting the row that the Row_Deleting event is handled. But there is a simple solution also available.

Alternative Solution

Instead of creating a event of RowDeleting, there is a best practice that you should change the command name from delete to something else like Delete_Product or something else.

Ebook Download
View all
Learn
View all