Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Collapse]Editors and Simple Controls
    Templated ListBox Items
   [Collapse]Simple Editors
    [Expand]Included Components
    [Expand]Editors Structure
    [Expand]Editors Features
    [Expand]Member Tables
    [Collapse]Examples
     [Expand]Data Binding
      How to: Add Scrollbars for PictureBox
      How to: Add Value Entered by User to LookUpEdit's Data Source
      How to: Assign Custom Shortcut Used to Open/Close Popup Editor's Window
      How to: Change Current UI Culture
      How to: Change Item's Height in ComboBoxEdit
      How to: Change Page's Position in XtraTabControl
      How to: Control Appearance of Multiple Controls via StyleController
      How to: Copy Selected Text in TextEdit Control
      How to: Create and Place Onto Form Horizontal Scroll Bar at Runtime
      How to: Create and Populate CheckedListBoxControl at Runtime
      How to: Create ButtonEdit Control in Code
      How to: Create Column with Custom Data in LookUpEdit
      How to: Create ImageComboBoxEdit Control at Runtime
      How to: Create ListBoxControl at Runtime
      How to: Create Lookup Editor and Bind It to Data Source
      How to: Create New DataNavigator Control
      How to: Create New Vertical ScrollBar at Runtime
      How to: Create Radio Group and Respond to Value Selection
      How to: Create SimpleButton Control
      How to: Create XtraTabControl at Runtime
      How to: Custom Paint ComboBoxEdit's Items
      How to: Custom Paint ListBoxControl's Items
      How to: Customize HyperLinkEdit's Command via Event
      How to: Customize Operand Editor Properties in FilterControl
      How to: Delete ListBoxControl's Items That Include Specific Strings
      How to: Disable CheckedComboBoxEdit's Items via Event
      How to: Disable Specific Items in CheckedListBoxControl via Event
      How to: Display Custom Button Within XtraTab Control
      How to: Display Custom Controls in Popup
      How to: Display File Operation's Progress via ProgressBarControl
      How to: Display QR Bar Code in BarCodeControl
      How to: Display Set of Boolean Options in CheckedComboBoxEdit Control
      How to: Enable Opening ComboBox's Dropdown Window Based on Custom Logic
      How to: Format Text in CheckEdit Using HTML Tags
      How to: Format Text in LabelControl Using HTML Tags
      How to: Implement Custom Tooltip for TrackBarControl's Thumb
      How to: Implement Error Notifications for Custom Business Object on Data Source Level
      How to: Implement Hyperlink Functionality by Handling OpenLink Event
      How to: Paint Background of Numbers in DateEdit Using Skin Element
      How to: Paste Clipboard's Text to TextBox Control
      How to: Perform Custom Actions when End-Users Click Navigator Buttons
      How to: Prevent Displaying TextEdit Menu via BeforeShowMenu Event
      How to: Prevent Popup Window Closing for PopupContainerEdit
      How to: Remove Specific Operators from FilterControl
      How to: Respond to Changing CheckEdit's State
      How to: Respond to Checking Items in CheckedListBoxControl
      How to: Respond to Clicking ButtonEdit's Embedded Buttons
      How to: Respond to Clicking Close Button in XtraTabControl
      How to: Respond to Editor's Value Modification
      How to: Respond to Selecting ComboBoxEdit's Items
      How to: Respond to Selecting ListBoxControl's Items
      How to: Restrict User Input in Date Editor
      How to: Restrict Values Being Entered in Editors
      How to: Set Custom Height for Specific Items in ListBoxControl
      How to: Share Editors Between Multiple XtraGrid Controls
      How to: Show Array of Strings in ListBoxControl
      How to: Show Enumeration's Values in ImageComboBoxEdit Control
      How to: Show Values of Enumeration in CheckedComboBoxEdit
      How to: Supply Custom Error Icon for Editor
      How to: Use Custom Value Editor in FilterControl
      How to: Validate Data via DXValidationProvider Component
   [Expand]Lookup Editors
   [Expand]Token Edit Control
   [Expand]Breadcrumb Edit Control
   [Expand]Range Control
   [Expand]Image Slider
    Camera Control
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap 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]Document Server
[Expand]Reporting
[Expand]Report 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: Implement Error Notifications for Custom Business Object on Data Source Level

The following example demonstrates how to implement error notifications for a custom business object at the data source level, using the IDXDataErrorInfo interface. Error information will be handled by the DXErrorProvider component, which will indicate any error to an end-user.

In this example, the business object is represented by a custom MyRecord class. It contains two properties (FirstName and LastName) that cannot be empty. This class' records are stored in a System.Windows.Forms.BindingSource component and edited using text editors (the FirstName and LastName properties are edited in a textEdit1 and textEdit2 controls respectively).

The requirement is to visually indicate errors within the editors, if the record's FirstName or LastName property contain an empty string. In this example, the error information is provided on the data source level. The MyRecord class implements the IDXDataErrorInfo interface and returns the error information via the IDXDataErrorInfo.GetPropertyError method. To display the supplied errors within the editors, a DXErrorProvider component needs to be added to the form. It indicates errors as error icons, which can be hovered over to display error text.

To automatically track errors supplied by a data source, the DXErrorProvider component must be bound to this data source via the DXErrorProvider.DataSource property. In this example, the DXErrorProvider.DataSource property is set to the BindingSource.

The following image illustrates the resulting form after it has been opened at runtime. The editors contain empty strings, and as a result error icons are displayed within the editors:

How would you rate this topic?​​​​​​​