Back to Devexpress

ASPxGridViewEditingSettings.Mode Property

aspnet-devexpress-dot-web-dot-aspxgridvieweditingsettings.md

latest6.2 KB
Original Source

ASPxGridViewEditingSettings.Mode Property

Gets or sets a value that specifies the ASPxGridView’s editing mode.

Namespace : DevExpress.Web

Assembly : DevExpress.Web.v25.2.dll

NuGet Package : DevExpress.Web

Declaration

csharp
[DefaultValue(GridViewEditingMode.EditFormAndDisplayRow)]
public GridViewEditingMode Mode { get; set; }
vb
<DefaultValue(GridViewEditingMode.EditFormAndDisplayRow)>
Public Property Mode As GridViewEditingMode

Property Value

TypeDefaultDescription
GridViewEditingModeEditFormAndDisplayRow

A GridViewEditingMode enumeration value that specifies the ASPxGridView’s editing mode.

|

Available values:

NameDescription
Inline

Cell values are edited within the In-Line Edit Row.

| | EditForm |

Cell values are edited via the Edit Form. The data row whose values are currently being edited isn’t displayed.

| | EditFormAndDisplayRow |

Cell values are edited via the Edit Form. The data row whose values are currently being edited is displayed above the Edit Form.

| | PopupEditForm |

Cell values are edited via the Popup Edit Form.

| | Batch |

Cell values are edited in the in-line editors. The changes are sent to the server only on an update (‘Save changes’) button click.

Note - the Batch Edit mode has limitations. To learn more, see the Batch Edit Mode topic.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to Mode
ASPxGridView

.SettingsEditing .Mode

| | GridViewProperties |

.SettingsEditing .Mode

|

Remarks

To learn more about data editing, see the following topics:

Web Forms Example

The code sample below specifies the grid’s edit mode in markup:

aspx
<dx:ASPxGridView ID="Grid" runat="server" ...>
    <%--...--%>
    <SettingsEditing Mode="Batch" />
</dx:ASPxGridView>

The following example demonstrates how to specify the grid’s edit mode in code:

csharp
protected void Page_Init(object sender, EventArgs e) {
    var commandColumn = new GridViewCommandColumn() {
        ShowEditButton = true
    };
    Grid.Columns.Add(commandColumn);
    Grid.SettingsEditing.Mode = GridViewEditingMode.Inline;
    // ...
}
vb
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
    Dim commandColumn = New GridViewCommandColumn() With {
        .ShowEditButton = True
    }
    Grid.Columns.Add(commandColumn)
    Grid.SettingsEditing.Mode = GridViewEditingMode.Inline
    ' ...
End Sub

MVC Example

csharp
@Html.DevExpress().GridView(settings => {
    settings.Name = "gridView";
    // ...
    settings.SettingsEditing.Mode = GridViewEditingMode.Batch;
}).Bind(Model).GetHtml()

Online Demos

Run Demo: Grid View - Edit Modes (Web Froms)

Run Demo: Grid View - Edit Modes (MVC)

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Mode property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-web-forms-grid-emulate-command-button-functionality/CS/WebSite/Default.aspx.cs#L37

csharp
var editMode = (GridViewEditingMode)Enum.Parse(typeof(GridViewEditingMode), cmbxEditForm.Value.ToString());
    grid.SettingsEditing.Mode = editMode;
}

asp-net-web-forms-grid-emulate-command-button-functionality/VB/WebSite/Default.aspx.vb#L37

vb
Dim editMode = DirectCast(System.Enum.Parse(GetType(GridViewEditingMode), cmbxEditForm.Value.ToString()), GridViewEditingMode)
    grid.SettingsEditing.Mode = editMode
End Sub

See Also

ASPxGridViewEditingSettings Class

ASPxGridViewEditingSettings Members

DevExpress.Web Namespace