# Data Validation

Data validation is a feature of **RadSpreadsheet** that helps you define restrictions on what data can be entered in a cell. This is achieved by defining data validation rules which consist of a rule type, one or more arguments and a comparison operator for some of the rule types. You can specify messages that users will see before editing a cell or after entering invalid data.

## How to Set Data Validation Rules

You can easily set data validation rules using the data validation dialog which can be shown from the Data tab in the predefined RibbonView, as shown below.

> caption Data validation dialog

![Rad Spreadsheet UI Data Validation 01](https://www.telerik.com/products/wpf/documentation/assets/eba803c44fb88fe209357195fe48e007/radspreadsheet_ui_data_validation_01.png)

> tip Detailed information on the different validation rules is available in the [Data Validation for SpreadProcessing article](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/features/data-validation).

The dialog contains two other tabs - one allowing to customize the input message that is shown when the cell is selected, and one allowing to change the alert shown when there is an error in the cell.

## Circle Invalid Data

Data Validation allows you to turn on the option to circle invalid data. This way you can always see if there is any invalid data in your document. You can toggle this option using the ribbon or through code.

The following image shows how to turn on the option and the result when invalid data is present in the worksheet.

> caption Circle invalid data

![Rad Spreadsheet UI Data Validation 01](https://www.telerik.com/products/wpf/documentation/assets/0c95b079fb6aec1fc56e849f872489f3/radspreadsheet_ui_data_validation_02.png)

The following example shows the use of the two methods that toggle this functionality - **CircleInvalidData()** and **ClearInvalidDataCircles()**.

**Turn On and Off Invalid Data Circles**

```C#
if (showCircles)
{
    this.radSpreadsheet.ActiveWorksheetEditor.CircleInvalidData();
}
else
{
    this.radSpreadsheet.ActiveWorksheetEditor.ClearInvalidDataCircles();
}
```

```VB.NET
	If showCircles Then
		Me.radSpreadsheet.ActiveWorksheetEditor.CircleInvalidData()
	Else
		Me.radSpreadsheet.ActiveWorksheetEditor.ClearInvalidDataCircles()
	End If
```

## See Also

* [Data Validation for SpreadProcessing article](https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/features/data-validation)
