System.Web.UI.WebControls.ObjectDataSourceView.ExecuteDelete Method

Performs a delete operation using the ObjectDataSourceView.DeleteMethod method and the specified keys and oldValues collection.

Syntax

protected override int ExecuteDelete (IDictionary keys, IDictionary oldValues)

Parameters

keys
A IDictionary of parameters used with the ObjectDataSourceView.DeleteMethod property to perform the delete operation. If there are no parameters associated with the method, pass null.
oldValues
A IDictionary that contains row values that are evaluated, only if the ObjectDataSourceView.ConflictDetection property is set to the System.Web.UI.ConflictOptions.CompareAllValues field.

Returns

The number of rows deleted; otherwise, -1, if the number is not known. For more information, see erload:System.Web.UI.WebControls.ObjectDataSourceView.Delete.

Remarks

The System.Web.UI.WebControls.ObjectDataSourceView class implements the inherited ObjectDataSourceView.ExecuteDelete(IDictionary, IDictionary) method to delete data from an underlying data store using a business object. Page developers and data-bound control authors do not call the ObjectDataSourceView.ExecuteDelete(IDictionary, IDictionary) method directly; instead, use the publicly exposed ObjectDataSource.Delete method.

Before the delete operation is performed, the ObjectDataSourceView.OnDeleting(ObjectDataSourceMethodEventArgs) method is called to raise the ObjectDataSourceView.Deleting event. You can handle this event to examine the values of the parameters and perform any preprocessing before the ObjectDataSourceView.Delete(IDictionary, IDictionary) method is called.

To perform a delete operation, the System.Web.UI.WebControls.ObjectDataSourceView uses reflection to call the method that is identified by the ObjectDataSourceView.DeleteMethod property and any associated parameters in the keys and oldValues collections, and then executes it. After the operation completes, the ObjectDataSourceView.OnDeleted(ObjectDataSourceStatusEventArgs) method is called to raise the ObjectDataSourceView.Deleted event. You can handle this event to examine any return values and error codes, and to perform any post-processing.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0