ListViewDeletedEventArgs::AffectedRows Property

 

Gets the number of rows that were affected by the delete operation.

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

public:
property int AffectedRows {
	int get();
}

Property Value

Type: System::Int32

The number of rows that were affected by the delete operation.

Use the AffectedRows property to determine the number of items that were affected by the delete operation, as reported by the data source control. This property is typically used to determine whether the correct number of items were deleted in the following ways:

  • To verify that only a single item was deleted. Sometimes an incorrectly written delete statement can delete multiple items.

  • To verify that an item was deleted if an error occurs during the delete operation but no exception was raised.

  • To verify that an item was deleted when a data source control that supports optimistic concurrency (such as the SqlDataSource and ObjectDataSource controls) has its ConflictDetection property set to the ConflictOptions.CompareAllValues enumeration value. Under this setting, an item that has been modified by another user might not be deleted.

The following example shows how to use the AffectedRows property to verify that an item was deleted during the delete operation.

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

.NET Framework
Available since 3.5
Return to top
Show: