2

I have One GridView in which I added one LinkButton in the TemplateField and Specified its Text as "Delete" and its purpose is to delete the Row. I have written all the Coding part to delete the Row in the GridView RowCommand Event. I clicked the GridView RowDeleting Event but I didn't write any code in that event and finally I removed that event both in the .cs file and also in the SourceCode.

But still when I delete the row, one error throws such as

 "The GridView 'gvToStock' fired event RowDeleting which wasn't handled."

and deleting function is not working.

But At the same time, If I included the RowDeleting Event in the .cs and source code file, its working fine.

What would be the reason for that?

10
  • Do you have a button named 'delete', or with a CommandName set to Delete? This is a reserved name, making the grid-view trigger the event - which you're not handling. That's why it works when you add a dummy event handler. Commented Jun 17, 2011 at 7:39
  • I added one Linkbutton in the GridView's TemplateField and its ID is "lnkDelete" and its Text="Delete" Commented Jun 17, 2011 at 7:42
  • try to change the ID, just to exclude this as a source of error. Commented Jun 17, 2011 at 8:05
  • @MartinHN: Which One I want to change? ID of the LinkButton Or the ID of the GridView. Commented Jun 17, 2011 at 8:10
  • 1
    That's why then. The command name fires the RowDeleting event, but you're not handling it - which is what the error message tells you. Commented Jun 17, 2011 at 9:53

1 Answer 1

3

Yes. As MartinHN Said, The Command Name specified in the LinkButton caused the Problem. The following link describes some detailed explanation about this:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.