[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
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Expand]Controls and Libraries
 [Collapse]Scaffolding Wizard
   Getting Started
  [Expand]Overview
  [Expand]Data Access Layer
   UI Generation
  [Collapse]Examples
    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: Implement Many-to-many Relations 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
  [Expand]Tutorials
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

Show Me

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

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