Error Notification
In This Article
This document describes how to implement error notifications for a data source, using IDXDataErrorInfo.
#Implementing the Error Notification Behavior
When binding a grid to a custom data source (e.g. data created at runtime), you generally create two classes:
- The class representing a data source. This class implements one of the interfaces (IList, IListSource, ITypedList, IBindingList) and provides access to the collection of records.
- The class implementing a single record in a data source.
To support error notifications, the class encapsulating a single record must implement the IDXDataErrorInfo interface. This interface provides two methods, which when implemented, get errors for the entire row and for individual cells (data source fields). As a result, the grid automatically displays error icons within cells with invalid values. Pointing to such an error icon displays a tooltip with an error description.
- IDXDataErrorInfo.GetPropertyError - When implemented by a class, returns information on an error associated with a specified property (data field) of a data object.
- IDXDataErrorInfo.GetError - When implemented by a class, returns information on an error associated with a data object (row).