Skip to main content

MVCxGridViewEditingSettings.ShowModelErrorsForEditors Property

Specifies whether the grid displays error messages for invalid editors in the Edit Form.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.2.dll

Declaration

public bool ShowModelErrorsForEditors { get; set; }

Property Value

Type Description
Boolean

true, to display error messages automatically; otherwise, false.

Property Paths

You can access this nested property as listed below:

Object Type Path to ShowModelErrorsForEditors
GridViewSettings
.SettingsEditing .ShowModelErrorsForEditors
MVCxGridView
.SettingsEditing .ShowModelErrorsForEditors
MVCxGridViewProperties
.SettingsEditing .ShowModelErrorsForEditors

Remarks

The grid automatically displays an error message near an editor if end users enter and submit invalid data due to the specified model validation rules. Use the ShowModelErrorsForEditors property to specify whether the grid displays error messages for invalid editors in the Edit Form. This property affects the ShowModelErrors property available for DevExpress MVC editors (e.g. TextBoxSettings.ShowModelErrors for TextBox).

settings.SettingsEditing.ShowModelErrorsForEditors = true;

Gridview Validation

To display a common error message in the error row, use the GridViewExtension.SetEditErrorText method.

Note

The GridViewExtension.SetEditErrorText method does not work when the grid is in batch edit mode.

@{
var grid = Html.DevExpress().GridView(settings => {
    settings.Name = "gvEditing";
    ...
    if (ViewData["EditError"] != null){
        grid.SetEditErrorText((string)ViewData["EditError"]);
    }
}

Concept

Validate Data

Online Demo

Grid View - Edit Modes

See Also