2 Replies - 1004 Views - Last Post: 22 January 2008 - 03:38 AM Rate Topic: -----

#1 thecornflake  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 16
  • Joined: 26-September 06

RESOLVED: Run additional checks when deleting from gridview/detailview

Post icon  Posted 21 January 2008 - 08:27 AM

I'm trying to figure out how to run additional checks when someone tries to delete a record from a Gridview or Detailview. I already have a confirmation using Javascript, but I want to perform some validation before the record is deleted.

My application has a list of servers and a list of environments. The environments are made up of several servers. I don't want the user to be able to delete a server that is still a member of an environment - they should be forced to change that server in the environment to another one so that the server they are trying to delete is no longer attached to it.

I know how to write the SQL statements etc, I just need to know how to catch the delete event before it happens and then continue it or stop it depending on the outcome of the SQL query.

This post has been edited by thecornflake: 22 January 2008 - 03:38 AM


Is This A Good Question/Topic? 0
  • +

Replies To: RESOLVED: Run additional checks when deleting from gridview/detailview

#2 girasquid  Icon User is offline

  • Barbarbar
  • member icon

Reputation: 108
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

Re: RESOLVED: Run additional checks when deleting from gridview/detailview

Posted 21 January 2008 - 06:41 PM

Try taking a look at the GridView.OnRowDeleting event.
Was This Post Helpful? 0
  • +
  • -

#3 thecornflake  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 16
  • Joined: 26-September 06

Re: RESOLVED: Run additional checks when deleting from gridview/detailview

Posted 22 January 2008 - 03:38 AM

Thanks. Once I searched for the event i found a good example of what I wanted to do.

For anyone else who's interested, in that event you do whatever your checks are and then if you want to stop the delete do -

e.cancel = true



to stop the delete occuring. The event occurs after delete is clicked, but before the row is deleted.
Was This Post Helpful? 1

Page 1 of 1