Performs a delete operation using the ObjectDataSourceView.DeleteMethod method and the specified keys and oldValues collection.
- 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.
The number of rows deleted; otherwise, -1, if the number is not known. For more information, see erload:System.Web.UI.WebControls.ObjectDataSourceView.Delete.
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.