ListView.DeleteItem Method (Int32)

 

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)

abstract DeleteItem : 
        itemIndex:int -> unit
override DeleteItem : 
        itemIndex:int -> unit

Parameters

itemIndex
Type: System.Int32

The index of the item to delete.

Exception Condition
InvalidOperationException

itemIndex is less than 0.

-or-

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

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.

.NET Framework
Available since 3.5
Return to top
Show: