Skip to main content

DateEditSettings.ShowModelErrors Property

Gets or sets a value that specifies whether or not model error messages should be automatically displayed for the editor when its value validation fails.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5


public bool ShowModelErrors { get; set; }

Property Value

Type Description

true if model error messages are automatically displayed for an invalid editor; false if the automatic error visualization feature is not used.


DevExpress MVC editors have the ShowModelErrors property that (when enabled) allows model error messages to be automatically displayed for invalid editors when validation fails. This minimizes your coding, since you do not need to use the Html.ValidationMessageFor extension method to visualize errors.

If the ShowModelErrors property is enabled, you can control how errors are visualized for an editor by using options exposed via the EditProperties.ValidationSettings property, available as the editor settings’ Properties.ValidationSettings property. For instance, you can play with the following options: ValidationSettings.ErrorDisplayMode, ValidationSettings.ErrorFrameStyle, ValidationSettings.ErrorImage.

To learn more, see our online demo: Data Editors - Validation


View (“ModelValidation”):

                <!-- Here goes editor-type specific extension method, such as Html.DevExpress().TextBox( -->
                    settings => {
                        settings.Name = "SomeData";
                        settings.ShowModelErrors = true;
                        settings.Properties.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;


    public class ModelValidationData {
        [Required(ErrorMessage = "SomeData is required")]
        public string SomeData { get; set; }


        public ActionResult ModelValidation() {
            return View("ModelValidation", new ModelValidationData());
        public ActionResult ModelValidation([ModelBinder(typeof(DevExpressEditorsBinder))] ModelValidationData validationData) {
                return View("ModelValidation", "ModelValidationSuccess", validationData);
                return View("ModelValidation", validationData);
See Also