System.Web.UI.WebControls.DetailsViewUpdateEventArgs Class

Provides data for the DetailsView.ItemUpdating event.

See Also: DetailsViewUpdateEventArgs Members


public class DetailsViewUpdateEventArgs : System.ComponentModel.CancelEventArgs


The System.Web.UI.WebControls.DetailsView control raises the DetailsView.ItemUpdating event when an Update button (a button with its CommandName property set to "Update") within the control is clicked, but before the System.Web.UI.WebControls.DetailsView control updates the record. This allows you to provide an event handler that performs a custom routine, such as HTML-encoding the values of a record before updating it in the data source, whenever this event occurs.

A System.Web.UI.WebControls.DetailsViewUpdateEventArgs object is passed to the event handler, which allows you to determine the value of an optional command argument sent to the System.Web.UI.WebControls.DetailsView control and to indicate whether the update operation should be canceled. To determine the value of the command argument, use the DetailsViewUpdateEventArgs.CommandArgument property. To cancel the update operation, set the System.ComponentModel.CancelEventArgs.Cancel property to true. You can also read or modify the new values entered by the user by using the DetailsViewUpdatedEventArgs.Keys and DetailsViewUpdateEventArgs.NewValues properties. The DetailsViewUpdateEventArgs.Keys property contains the key fields, while the DetailsViewUpdateEventArgs.NewValues property contains the non-key fields. If you need to access the original non-key field values, use the DetailsViewUpdatedEventArgs.OldValues property.

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.DetailsViewUpdateEventArgs class, see the DetailsViewUpdateEventArgs.#ctor(object) constructor.


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