[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Expand]Controls and Libraries
 [Collapse]Scaffolding Wizard
   Getting Started
  [Expand]Data Access Layer
   UI Generation
    How to: Affect Auto-Generated Columns and Edit Fields at the Data Model Level
    How to: Create a Custom Filter
    How to: Add a New Detail Collection
    How to: Show Validation Errors when IDataErrorInfo is Used
    How to: Show Detail Views in Separate Windows
    How to: Manage Document Properties and Open Them Manually
    How to: Implement Many-to-many Relationships Editing
    Entity Names Autogeneration
    How to: Use Projections to Create Custom Queries and Optimize Performance
    How To: Improve Performance by Using the Instant Feedback Mode
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Show Validation Errors when IDataErrorInfo is Used

This document describes how to display validation errors in the application you created with the DevExpress Scaffolding Wizard.

Assume you have a simple entity that supports the IDataErrorInfo interface.

First, generate an application using the Scaffolding Wizard as described in the first lesson of the following tutorial: Building Office-Inspired Applications.

To display data items, the Scaffolding Wizard generates DataLayoutItem objects that, in turn, generate editors in runtime.

After completing the initial steps, validation errors will be displayed in the following manner.

In most cases, saving the changes to a database should be prohibited if the entity supports the IDataErrorInfo interface and there data errors in the entity. The generated application supports this scenario out of the box. If you want to allow the end user save changes even if there data errors or implement your own validation logic, override the HasValidationErrors method generated by the Scaffolding Wizard.

If the HasValidationErrors method returns true, the Save button will be disabled. Additionally, when pressing the Close button, a modal warning dialog will appear with only two buttons: OK and Cancel.


A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T111378.

Is this topic helpful?​​​​​​​