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.v19.2.dll

Declaration

public bool ShowModelErrorsForEditors { get; set; }
Public Property ShowModelErrorsForEditors As Boolean

Property Value

Type Description
Boolean

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

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;

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