SqlDataSourceView::Deleting Event
Occurs before a delete operation.
Assembly: System.Web (in System.Web.dll)
Handle the Deleting event to perform additional initialization operations that are specific to your application, to validate the values of parameters, or to change the parameter values before the SqlDataSource control performs the delete operation.
The connection to the underlying data source is not yet open when the event handler delegate is called. Therefore, you cannot cancel the Delete operation directly by calling the Cancel method on the DbCommand object that is exposed by the SqlDataSourceCommandEventArgs object. You can, however, cancel the operation by setting the Cancel property of the SqlDataSourceCommandEventArgs to true.
For more information about handling events, see Consuming Events.
The following code example demonstrates how to handle the Deleting event that is raised before a delete operation occurs. Because this example deletes data from the Northwind database, an OnDeleting handler is added to attempt to back up the database to disk before the delete operation is performed.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.