Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SqlDataSource::Deleting Event

 

Occurs before a delete operation.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

public:
event SqlDataSourceCommandEventHandler^ Deleting {
	void add(SqlDataSourceCommandEventHandler^ value);
	void remove(SqlDataSourceCommandEventHandler^ value);
}

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 operation directly by calling the Cancel method on the DbCommand object that is exposed by the SqlDataSourceCommandEventArgs object. You can, however, cancel the database operation by setting the Cancel property of the SqlDataSourceCommandEventArgs object to true.

For more information about handling events, see NIB: 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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft