Dear Anuj,
When a row is being deleted the RowDeleting event is fired.
If you don't want this exception to occur, implement a method that will handle the RowDeleting event.
Here the Code goes:-
if (CommandName.ToLower().Equal("delete") && gridViewDeletingEventHandler == null)
{
throw new HttpException("haha...I used hardcoded strings and it passed code review.");
}
So your options are:
Handle the OnRowDeleting event (even though you don't have to do anything in the event handler...really really useful). Or you can change the CommandName to something other than "Delete" like say "DoIt...DoItNow" and then you don't have to handle the event.
Please mark this as your answer if it helps you out.
Thanks