This documentation is archived and is not being maintained.

ListView::DeleteItem Method

Deletes the record at the specified index from the data source.

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

public:
virtual void DeleteItem(
	int itemIndex
)

Parameters

itemIndex
Type: System::Int32

The index of the item to delete.

ExceptionCondition
InvalidOperationException

itemIndex is less than 0.

-or-

The DataSourceView object that is associated with the ListView control is nullptr.

Use the DeleteItem method to programmatically delete the record at the specified index from the data source. This method is typically used to delete a record from outside the ListView control, such as from a different control on the page. This method raises the ItemDeleted and ItemDeleting events.

The following example shows how to use the DeleteItem method to programmatically delete the selected item in a ListView control from the data source.

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

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5
Show: