System.Web.UI.WebControls.FormViewUpdateEventArgs Class

Provides data for the FormView.ItemUpdating event.

See Also: FormViewUpdateEventArgs Members


public class FormViewUpdateEventArgs : System.ComponentModel.CancelEventArgs


The System.Web.UI.WebControls.FormView control raises the FormView.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.FormView control updates the record. This allows you to provide an event-handling method that performs a custom routine, such as HTML encoding or validating the values of a record before updating it in the data source, whenever this event occurs.

A System.Web.UI.WebControls.FormViewUpdateEventArgs object is passed to the event-handling method, which allows you to determine the value of an optional command argument sent to the System.Web.UI.WebControls.FormView control and to indicate whether the update operation should be canceled. To determine the value of the command argument, use the FormViewUpdateEventArgs.CommandArgument property. To cancel the update operation, set the System.ComponentModel.CancelEventArgs.Cancel property to true. If you need to access the original key field values for the record being updated, use the FormViewUpdateEventArgs.Keys property. The original non-key field values can be accessed by using the FormViewUpdateEventArgs.OldValues property. Updated values (which include updated key field values, if you allow the user to edit key fields) are accessed using the FormViewUpdateEventArgs.NewValues 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.FormViewUpdateEventArgs class, see the FormViewUpdateEventArgs.#ctor(object) constructor.


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