System.Web.UI.WebControls.FormView.ChangeMode Method

Switches the System.Web.UI.WebControls.FormView control to the specified data-entry mode.

Syntax

public void ChangeMode (FormViewMode newMode)

Parameters

newMode
One of the System.Web.UI.WebControls.FormViewMode enumeration values.

Remarks

Use the FormView.ChangeMode(FormViewMode) method to programmatically switch the System.Web.UI.WebControls.FormView control between edit, insert, and read-only modes. This method also updates the FormView.CurrentMode property with the specified mode. The following table lists the different mode values.

FormViewMode.Edit

The System.Web.UI.WebControls.FormView control is in edit mode, which allows the user to update the values of a record.

FormViewMode.Insert

The System.Web.UI.WebControls.FormView control is in insert mode, which allows the user to add a new record to the data source.

FormView.ReadOnly

The System.Web.UI.WebControls.FormView control is in read-only mode, which is the normal display mode.

Note:

The FormView.ModeChanged and FormView.ModeChanging events are not raised when this method is called.

Requirements

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