System.Web.UI.WebControls Namespace DetailsView Class
.NET Framework version 2.0
Deletes the current record in the DetailsView control from the data source.
[ VB ]
Overridable Public Sub DeleteItem ( )
[ C# ]
public virtual void DeleteItem ( );
[ C++ ]
public: virtual void DeleteItem ( );
[ JScript ]
public function DeleteItem ( );
Use the DeleteItem method to programmatically delete the current record in the DetailsView control from the data source.
This method is commonly used when you need to delete the current record from outside of the DetailsView control, such as from a different control on the page.
Calling this method also raises the ItemDeleted and ItemDeleting events.
The following example demonstrates how to use the DeleteItem method to programmatically delete the current record in a DetailsView control from the data source.
<%@ Page language = "C#" %>
<script runat = "server">
void DeleteButton_Click ( Object src, EventArgs e ) {
EmployeeDetailsView.DeleteItem ( );
}
</script>
<%@ Page language = "VB" %>
<script runat = "server">
Sub DeleteButton_Click ( ByVal src As Object, ByVal e As EventArgs )
EmployeeDetailsView.DeleteItem ( )
End Sub
</script> |
|
C# |
VB |
DetailsView Members InsertItem UpdateItem