Skip to main content
A newer version of this page is available. .

Data Editing and Validation

  • 2 minutes to read

Data Editing

Edit Cell Values

The Edit Cell Values in UI section describes end-user data editing capabilities. It also explains how you can customize these features. For a list of API methods, refer to the following help topic: Obtain and Set Cell Values in Code.

The view‘s NavigationStyle property specifies whether users can focus rows and individual cells. When this property is set to Row, users can only edit existing data in the customizable Edit Form.

Inline Edit Form

The Edit Entire Row topic describes how to use the editor to submit or cancel all changes applied to a row. Note that this mode is only available when the NavigationStyle property is set to Cell.

Edit Rows

The Add and Remove Rows topic explains how to add/remove data records in the UI or in code.

Clipboard Operations

The Clipboard Management topic describes how to perform copy and paste operations in the UI or in code.

Examples

Validation

GridControl Level

The GridControl raises special events that allow you to validate modified cells and rows:

Masks

A basic way to implement data validation is to use masks. Masks restrict data input and format data output.

Use a column’s EditSettings property to specify a mask.

<dxg:GridColumn FieldName="Name"   >
    <dxg:GridColumn.EditSettings>
        <dxe:TextEditSettings Mask="C" MaskType="Numeric" />
    </dxg:GridColumn.EditSettings>
</dxg:GridColumn>

Alternatively, you can specify a CellTemplate.

<dxg:GridColumn FieldName="Id" >
    <dxg:GridColumn.CellTemplate>
        <DataTemplate>
            <dxe:TextEdit x:Name="PART_Editor" Mask="C"  MaskType="Numeric"/>
        </DataTemplate>
    </dxg:GridColumn.CellTemplate>
</dxg:GridColumn>

For more information on masks, refer to the following help topic: Masked Input.

Note

Do not use the editor’s events to validate grid data. Use the grid’s events instead.

Data Level

You can validate data based on interfaces and attributes:

ValidationService

To use the ValidationService, set the IsValidationContainer property to true for the GridControl.

Examples

CRUD Operations

You can implement CRUD operations (create, read update, delete). These operations allow users to manage data in the Data Grid. Refer to the following topic for more information: Implement CRUD Operations in a Data-Bound Grid.

View Example: How to Implement CRUD Operations in a Data-Bound Grid