[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Get Started With Data Grid and Views
   [Expand]Data Binding
    Unbound Columns
   [Collapse]Data Editing and Validation
    [Collapse]ErrorInfo Support
      Internal ErrorInfo Support
      Implementing ErrorInfo Support for Data Sources
     Add and Remove Rows
     Modify and Validate Cell Values
   [Expand]Filter and Search
   [Expand]Focus and Selection Handling
    Format Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
    Hit Information
    Popup Menus
   [Expand]Save and Restore Layout
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[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)

Implementing ErrorInfo Support for Data Sources

If the grid control is bound to a System.Data.DataView or System.Data.DataTable, you can set errors for any cell within any row using methods provided by the data source.

To set an error for a particular cell, you can call the System.Data.DataRow.SetColumnError method of a specific DataRow object. The grid control will indicate such errors by displaying error icons () within cells with the descriptions displayed as tooltips.

To support error notifications for any cell and row for other data source types (IList, ITypedList, IListSource, IBindingList, etc), you should implement the IDXDataErrorInfo or System.ComponentModel.IDataErrorInfo interface for the objects representing records in your data source. This document gives you an example of implementing the IDataErrorInfo interface for a custom data source.

Note that the grid control provides methods to set errors for individual cells within the focused row and for the entire focused row. These methods can be applied regardless of the data source type. Usually you use these methods when validating the user's input via the BaseView.ValidateEditor and/or ColumnView.ValidateRow events. For more information, refer to the Internal ErrorInfo Support document.

Expanded Implementing the Error Notification Behavior

To bind a grid control to data created at runtime, you usually create two classes:

  • the class representing a data source; this implements one of interfaces (IList, IListSource, ITypedList, IBindingList) and provides access to the collection of records;
  • the class implementing a single record for a data source class.

If a data source supports error notifications, you are able to implement a validation procedure to verify data contained in the data source and, if invalid data is encountered, set errors for particular records and record's fields.

To support error notifications, the class encapsulating a single record must implement the System.ComponentModel.IDataErrorInfo interface. This allows two members to get error descriptions for the entire record and for individual record's properties (data source fields). If a record object implements the interface, the grid control will display error icons within cells for which errors were set via the data source. Pointing to such an error icon displays a tooltip with an error description.


The GridUnboundErrorNotification tutorial (C:\Users\Public\Documents\DevExpress Demos 19.1\Components\WinForms\CS\GridTutorials\GridTutorials.csproj) shows how to implement the System.ComponentModel.IDataErrorInfo interface for a custom data source.

The NoteInfo class represents a single record and provides the Day, Month, Year and NoteID fields displayed as columns in a grid control. This class implements the System.ComponentModel.IDataErrorInfo interface and also introduces methods managing errors. It provides the SetColumnError, GetColumnError methods and NoteError property to get and set error descriptions for individual properties (Day, Month, Year and NoteID) and the entire record.

To clear a specific error, one should set the error to an empty string.


The ProjectNotes class manages a collection of NoteInfo objects and this represents a data source for a grid control. This class supports change notifications by implementing the System.ComponentModel.IBindingList interface. When a new record is added or when record's properties and error descriptions are set, the IBindingList.ListChanged event is fired thus notifying the grid control that a particular record should be updated. You can refer to the Data Editing and Validation document for details on implementing data change notifications.


Data is validated within a custom ValidateData procedure. This traverses all records and checks the validity of data. If a record refers to an invalid date, an error is set for this record and for the date column where an error is encountered. The grid will indicate the errors with error icons as shown in the image below. Pointing to an icon displays a descriptive tooltip.

See the GridUnboundErrorNotification tutorial (C:\Users\Public\Documents\DevExpress Demos 19.1\Components\WinForms\CS\GridTutorials\GridTutorials.csproj) for the complete code.

Expanded See Also

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