Handling GridView's delete event fired from a CommandField?

G

gnewsgroup

I searched around and it seems no one has ever run into this.

I am using a CommandField (although an extended CommanField from
http://www.codeproject.com/KB/aspnet/ExtendedCommandField.aspx for the
added client confirmation feature) for row deletion in a GridView.

The GridView is wrapped up in the Ajax UpdatePanel. Everything is
working OK, except a little drawback, i.e., when one tries to delete
something that's NOT deletable in the database, the AJAX framework
catches the SqlException and displays it in a popup like this one:

http://farm3.static.flickr.com/2324/2109035498_d9c592a501_o.png

How do I handle this particular delete event of a CommandField
manually, so that I can display a customized message like "Another
table is referring to this order and thus it cannot be deleted."?

I know that I can do this if I use a TemplateField instead of a
CommandField, but that would mean a lot more code to write.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top