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
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 |
|
MVCxGridView |
|
MVCxGridViewProperties |
|
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"]);
}
}