System.Web.UI.WebControls.DetailsViewInsertedEventArgs Class

Provides data for the DetailsView.ItemInserted event.

See Also: DetailsViewInsertedEventArgs Members


public class DetailsViewInsertedEventArgs : EventArgs


The System.Web.UI.WebControls.DetailsView control raises the DetailsView.ItemInserted event when an Insert button (a button with its CommandName property set to "Insert") within the control is clicked, but after the System.Web.UI.WebControls.DetailsView control inserts the record. This allows you to provide an event handler that performs a custom routine, such as checking the results of an insert operation, whenever this event occurs.

A System.Web.UI.WebControls.DetailsViewInsertedEventArgs object is passed to the event handler, which allows you to determine the number of records affected and any exceptions that might have occurred. To determine the number of records affected by the insert operation, use the DetailsViewInsertedEventArgs.AffectedRows property. Use the DetailsViewInsertedEventArgs.Exception property to determine whether any exceptions occurred. You can also indicate whether the exception was handled in the event handler by setting the DetailsViewInsertedEventArgs.ExceptionHandled property. If you need to access the values of the inserted record, use the DetailsViewInsertedEventArgs.Values property.

By default, the System.Web.UI.WebControls.DetailsView control returns to the mode specified by the DetailsView.DefaultMode property after an insert operation. To keep the System.Web.UI.WebControls.DetailsView control in insert mode, set the DetailsViewInsertedEventArgs.KeepInInsertMode property to true.

For more information about handling events, see Consuming Events.

For a list of initial property values for an instance of the System.Web.UI.WebControls.DetailsViewDeletedEventArgs class, see the DetailsViewDeletedEventArgs.#ctor(int, Exception) constructor.


Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions:
Since: .NET 2.0