System.Web.UI.WebControls.DetailsView.ModeChanging Event

Occurs when a System.Web.UI.WebControls.DetailsView control attempts to change between edit, insert, and read-only mode, but before the DetailsView.CurrentMode property is updated.

Syntax

public event DetailsViewModeEventHandler ModeChanging

Remarks

The DetailsView.ModeChanging event is raised when a System.Web.UI.WebControls.DetailsView control attempts to change between edit, insert, and read-only mode, but before the DetailsView.CurrentMode property is updated. This allows you to provide an event handler that performs a custom routine, such as canceling the mode change, whenever this event occurs.

A System.Web.UI.WebControls.DetailsViewModeEventArgs object is passed to the event handler, which allows you to determine the new mode, to determine whether the mode change was a result of the user canceling an edit operation, or to cancel the mode change. To determine the new mode, use the DetailsViewModeEventArgs.NewMode property. To determine whether the mode change was a result of the user canceling an edit operation, use the DetailsViewModeEventArgs.CancelingEdit property. You can cancel the mode change by setting the System.ComponentModel.CancelEventArgs.Cancel property to true.

For more information about handling events, see Consuming Events.

Requirements

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