[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
  [Expand]Chart Control
  [Expand]Pivot Grid
   [Expand]Product Information
    Getting Started
    [Expand]Spreadsheet Document
     Supported Formats
     Import and Export
    [Expand]Cell Basics
     Defined Names
     Data Validation
    [Expand]Data Presentation
     Pivot Table
    [Expand]Mail Merge
     Modify Documents in Code
     Keyboard Shortcuts
   [Expand]Visual Elements
  [Expand]Rich Text Editor
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[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)

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 you to restrict data that can be entered into a cell. It assists the users in entering data that is valid. You can allow end-users to enter invalid data, but then warn them 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 ASPxSpreadsheetStringId.DataValidation 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 using the Worksheet.DataValidations property.

To add a new data validation rule, use the DataValidationCollection.Add method of the collection. To cancel a 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 on 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.





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

Expanded See Also

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