[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
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
    Product Structure
   [Expand]Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charts and Graphics
    Find and Replace
   [Expand]Mail Merge
   [Expand]Visual Elements
    Themes and Templates
  [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)

Data Validation

This document introduces the Data Validation concept and demonstrates how to manage data validation rules in a worksheet using the Data Validation API.

Expanded Data Validation Overview

Data validation allows restricting the data which can be entered in a cell. It assists the users in entering data that is valid. You can allow entering invalid data, but warn the users when that occurs. You can also provide messages to explain the reason for the restriction or to instruct users how to correct errors.

End-users are provided with the Data Tools command group located on the Data Ribbon tab, to invoke a Data Validation dialog and to identify cells with invalid data by displaying a red circle around them.

When a user attempts to enter a value that is not correct according to validation rules, an alert is shown. Alert text is specified with the XtraSpreadsheetStringId.Msg_DataValidationFailed enumeration member so it can be easily localized, as described in the Localization topic.

You can also provide a custom message that explains what data can be entered in a cell, and a custom error dialog that appears when incorrect data is entered.

Expanded Data Validation API

The DataValidation interface provides information describing the data validation rule - the DataValidation.Range in which the rule is in effect, the DataValidation.ValidationType and other options which can be used while validating data.

Data validation rules in a worksheet are contained in the DataValidationCollection collection which is accessible via the Worksheet.DataValidations property.

To add a new data validation rule, use the DataValidationCollection.Add method of the collection. To cancel a particular rule, remove it from the collection. To remove all data validation rules, clear the collection.

Expanded Data Validation Common Tasks


API Members

User Interface

Restrict data to predefined items in a list.


Restrict numbers outside a specified range.




Restrict dates and times outside a certain time frame.



Limit the number of text characters.



Validate data based on formulas or values in other cells.


Create a message that explains what data can be entered in a cell.




Create a message that appears when the end-user types incorrect data.





Display or hide circles around invalid data.

The SpreadsheetControl circles only first 255 invalid cells,

other invalid entries are ignored.



The code snippet below illustrates how to create and apply different validation criteria to worksheet cells using Data Validation API.

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