[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
 [Collapse]Controls and Libraries
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Collapse]Data Editing and Validation
     Add and Remove Rows
    [Expand]Modify Cell Values
    [Collapse]Input Validation
      Cell Validation
      Row Validation
      Interfaces-Based Validation
      Attributes-Based Validation
    [Expand]Clipboard Management
   [Expand]Filtering and Searching
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus, Navigation, Selection
   [Expand]Conditional Formatting
   [Expand]Appearance Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  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)

Attributes-Based Validation

The GridControl supports DataAnnotations attributes that specify data validation rules. You should reference the System.ComponentModel.DataAnnotations assembly to use data annotation attributes.

Expanded Data Annotation Attributes

Validation Attribute Description
System.ComponentModel.DataAnnotations.CustomValidationAttribute Specifies a custom validation method.
System.ComponentModel.DataAnnotations.DataTypeAttribute Specifies a particular data type, such as an e-mail address or a phone number.
System.ComponentModel.DataAnnotations.EnumDataTypeAttribute Ensures that the value exists in an enumeration.
System.ComponentModel.DataAnnotations.RangeAttribute Designates minimum and maximum constraints.
System.ComponentModel.DataAnnotations.RegularExpressionAttribute Uses a regular expression to determine valid values.
System.ComponentModel.DataAnnotations.RequiredAttribute Specifies that a value must be provided.
System.ComponentModel.DataAnnotations.StringLengthAttribute Designates maximum and minimum number of characters.

Expanded Default Behavior

The GridControl displays error icons () within cells with invalid values, and provides error descriptions displayed as tooltips. In this case, you cannot focus another cell until the cell's value is corrected:

Demo: Data Validation

Expanded Custom Validation

The following validation options allow you to override default behavior:

Validation Attribute




If set to false, hides validation errors specified via DataAnnotations attributes.


If set to true, posts the invalid value to a data source and allows the cell focus to be moved to another cell.


The attributes-based validation does not work when using the ColumnBase.Binding property.

Refer to the How to: Implement Attributes-Based Validation example to learn more.

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