This documentation is archived and is not being maintained.

GridView.DeleteRow Method

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

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

abstract DeleteRow : 
        rowIndex:int -> unit 
override DeleteRow : 
        rowIndex:int -> unit 


Type: System.Int32
The index of the row to delete.


The GridView control is not bound to a data source control.


The data source control that the GridView control is bound to does not support delete operations, or there is no delete command defined for the data source.

Use the DeleteRow method to programmatically delete the record at the specified index from the data source. This method is commonly used when you need to delete a record from outside of the GridView control, such as from a different control on the page. Calling this method also raises the RowDeleted and RowDeleting events.

The following example demonstrates how to use the DeleteRow method to programmatically delete a record in a GridView control.

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

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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