Export (0) Print
Expand All
Expand Minimize

FormView::CurrentMode Property

Gets the current data-entry mode of the FormView control.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

[BrowsableAttribute(false)]
public:
property FormViewMode CurrentMode {
	FormViewMode get ();
}

Property Value

Type: System.Web.UI.WebControls::FormViewMode
One of the FormViewMode values.

Use the CurrentMode property to determine whether the FormView control is in edit, insert, or read-only mode. The following table lists the different mode values.

Mode

Description

FormViewMode.Edit

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

FormViewMode.Insert

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

FormView.ReadOnly

The FormView control is in read-only mode, which is the normal display mode.

This value is normally set automatically by the FormView control when the New, Update, Insert, Delete, or Cancel command button is clicked. When the FormView control changes modes in response to an action, the events in the following table are raised. This allows you to create a custom event handler that performs the appropriate routine when the event occurs.

Event

Description

ModeChanged

Occurs when the FormView control changes modes, but after the mode changes. This event is commonly used to perform a task whenever the FormView control changes modes.

ModeChanging

Occurs when the FormView control changes modes, but before the mode changes. This event is commonly used to cancel the mode change.

Note   These events are not raised when you change the mode programmatically by using the ChangeMode method.

The following example demonstrates how to use the CurrentMode property to determine whether the FormView control is in edit, insert, or read-only mode. If the user attempts to navigate to another record while the FormView control is in edit more, the paging operation is canceled.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft