System.Web.UI.WebControls.GridViewUpdatedEventArgs Class

Provides data for the GridView.RowUpdated event.

See Also: GridViewUpdatedEventArgs Members


public class GridViewUpdatedEventArgs : EventArgs


The System.Web.UI.WebControls.GridView control raises the GridView.RowUpdated event when an Update button in the control is clicked, but after the System.Web.UI.WebControls.GridView control updates the record. (An Update button is a button control whose CommandName property is set to "Update".) You can perform a custom routine whenever this event occurs, such as checking the results of an update operation.

A System.Web.UI.WebControls.GridViewUpdatedEventArgs object is passed to the event handler, which enables you to determine the number of records that were affected and any exceptions that might have occurred. To determine the number of records that were affected by the update operation, use the GridViewUpdatedEventArgs.AffectedRows property. To determine whether any exceptions occurred, use the GridViewUpdatedEventArgs.Exception property. You can also indicate whether the exception was handled in the event handler by setting the GridViewUpdatedEventArgs.ExceptionHandled property.

To access the key field values for the updated record, use the GridViewUpdatedEventArgs.Keys property. You can access the original non-key field values by using the GridViewUpdatedEventArgs.OldValues property. You can access the updated non-key field values by using the GridViewUpdatedEventArgs.NewValues properties.

By default, the System.Web.UI.WebControls.GridView control returns to read-only mode after an update operation. When you handle an exception that occurred during the update operation, you can keep the System.Web.UI.WebControls.GridView control in edit mode by setting the GridViewUpdatedEventArgs.KeepInEditMode property to true.

For more information about how to handle events, see Consuming Events.

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


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