Provides data for the DetailsView.ModeChanging event.
See Also: DetailsViewModeEventArgs Members
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 mode actually changes. This allows you to provide an event handler that performs a custom routine, such as configuring the System.Web.UI.WebControls.DetailsView control for a specific mode or 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 mode to which the System.Web.UI.WebControls.DetailsView control is changing, to determine whether the DetailsView.ModeChanging event was raised as a result of the user canceling an edit operation, or to indicate that an insert operation should be canceled. To determine the new mode, use the DetailsViewModeEventArgs.NewMode property. You can also use the DetailsViewModeEventArgs.NewMode property to change to an alternate mode by setting it to one of the System.Web.UI.WebControls.DetailsViewMode enumeration values. Use the DetailsViewModeEventArgs.CancelingEdit property to determine whether the user canceled an edit operation. To cancel an insert operation, set the System.ComponentModel.CancelEventArgs.Cancel 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.DetailsViewModeEventArgs class, see the DetailsViewModeEventArgs.#ctor(DetailsViewMode, bool) constructor.