This documentation is archived and is not being maintained.

DataSourceView.ExecuteDelete Method

Performs a delete operation on the list of data that the DataSourceView object represents.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

virtual int ExecuteDelete (
	IDictionary^ keys, 
	IDictionary^ oldValues
protected int ExecuteDelete (
	IDictionary keys, 
	IDictionary oldValues
protected function ExecuteDelete (
	keys : IDictionary, 
	oldValues : IDictionary
) : int
Not applicable.



An IDictionary of object or row keys to be deleted by the ExecuteDelete operation.


An IDictionary of name/value pairs that represent data elements and their original values.

Return Value

The number of items that were deleted from the underlying data storage.

Exception typeCondition


The ExecuteDelete operation is not supported by the DataSourceView.

Data-bound controls can determine whether the ExecuteDelete operation is supported by a data source control by retrieving the DataSourceView object using the DataSourceControl.GetView method, and checking the CanDelete property.

The keys parameter represents the object or row keys of the data to delete. For data sources that represent relational data, such as the SqlDataSource control, the keys parameter is a collection of database primary keys. In other scenarios, the keys parameter is a collection of name/value pairs and is used to filter a list of data. Any data matching a name/value pair is deleted.


The DataSourceView class's default implementation is to throw a NotSupportedException exception. If you extend the DataSourceView class, override the ExecuteDelete method if your class supports deletion from the underlying data storage.

The following code example demonstrates how a class that extends the DataSourceView class can override the CanDelete property and the ExecuteDelete method. This code example is part of a larger example provided for the DataSourceView class.

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

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0