System.Web.UI.WebControls.FormViewModeEventArgs Class

Provides data for the FormView.ModeChanging event.

See Also: FormViewModeEventArgs Members

Syntax

public class FormViewModeEventArgs : System.ComponentModel.CancelEventArgs

Remarks

The FormView.ModeChanging event is raised when a System.Web.UI.WebControls.FormView control attempts to switch between edit, insert, and read-only mode, but before the mode actually changes. This allows you to provide an event-handling method that performs a custom routine, such as configuring the System.Web.UI.WebControls.FormView control for a specific mode or canceling the mode change, whenever this event occurs.

A System.Web.UI.WebControls.FormViewInsertEventArgs object is passed to the event-handling method, which allows you to determine the mode to which the System.Web.UI.WebControls.FormView control is changing, to determine whether the FormView.ModeChanging event was raised as a result of the user canceling an edit or insert operation, or to indicate that the mode change should be canceled. To determine the new mode, use the FormViewModeEventArgs.NewMode property. You can also use the FormViewModeEventArgs.NewMode property to programmatically specify an alternate mode to which to change by setting it to one of the System.Web.UI.WebControls.FormViewMode enumeration values. Use the FormViewModeEventArgs.CancelingEdit property to determine whether this event was raised as the result of the user canceling an edit or insert operation. To cancel the mode change, 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.FormViewModeEventArgs class, see the FormViewModeEventArgs.#ctor(FormViewMode, bool) constructor.

Requirements

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