# Input Validation | WPF Controls | DevExpress Documentation

You can validate new data before saving it to a data source. Likewise, you can ensure that invalid data is not saved to a data source and related errors are clearly displayed.

![Validation](/WPF/images/validation132305.png)

Note

When you use a custom [CellTemplate](/WPF/DevExpress.Xpf.Grid.ColumnBase.CellTemplate), input validation is supported only if the template contains a [BaseEdit](/WPF/DevExpress.Xpf.Editors.BaseEdit) class descendant that is declared as demonstrated in the following topic: [Custom In-Place Cell Editors](/WPF/DevExpress.Xpf.Grid.ColumnBase.CellTemplate#custom-in-place-cell-editors).

## GridControl Level

The [GridControl](/WPF/DevExpress.Xpf.Grid.GridControl) raises special events that allow you to validate modified cells and rows:

- [Cell Validation](/WPF/6113/controls-and-libraries/data-grid/data-editing-and-validation/input-validation/cell-validation)
- [Row Validation](/WPF/6114/controls-and-libraries/data-grid/data-editing-and-validation/input-validation/row-validation)

## Data Level

You can validate data based on interfaces and attributes: 

- [Interface-Based Validation](/WPF/6157/controls-and-libraries/data-grid/data-editing-and-validation/input-validation/interface-based-validation)
- [Attribute-Based Validation](/WPF/9770/controls-and-libraries/data-grid/data-editing-and-validation/input-validation/attribute-based-validation)

## Check Whether the Grid Contains Validation Errors

The [GridControl](/WPF/DevExpress.Xpf.Grid.GridControl) includes the following properties that allow you to check whether the grid has validation errors:

- The [DataViewBase.HasValidationError](/WPF/DevExpress.Xpf.Grid.DataViewBase.HasValidationError) property discloses whether the [GridControl](/WPF/DevExpress.Xpf.Grid.GridControl) contains validation errors that do not allow users to post changes to a data source. Use this property when you implement validation at the GridControl level.
- The [DataViewBase.HasErrors](/WPF/DevExpress.Xpf.Grid.DataViewBase.HasErrors) property (along with the [DataViewBase.ErrorsWatchMode](/WPF/DevExpress.Xpf.Grid.DataViewBase.ErrorsWatchMode) property) discloses whether the [GridControl](/WPF/DevExpress.Xpf.Grid.GridControl) contains validation errors posted to a data source. Use this property when you implement validation at the data level.

## Examples

- [How to: Validate Data Rows and Indicate Errors](https://github.com/DevExpress-Examples/wpf-data-grid-validate-data-rows)
- [How to: Validate Cell Editors](https://github.com/DevExpress-Examples/wpf-data-grid-validate-cell-editors)
- [How to: Implement an Edit Cell Confirmation](https://github.com/DevExpress-Examples/wpf-data-grid-implement-cell-editing-confirmation)
- [How to: Implement Attribute-Based Validation](https://github.com/DevExpress-Examples/wpf-data-grid-implement-attribute-based-validation)