Skip to content

Commit

Permalink
ASP.NET Core DataGrid: update Validation demo description (#3195)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladaskorohodova authored Apr 22, 2024
1 parent cca333c commit 07830ec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion MVCDemos/Content/Descr/DataGrid/DataValidation.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
The DataGrid UI component supports data validation against a set of predefined or custom validation rules. These rules are generated based on Data Annotations that decorate the model properties (see the _EmployeeValidation.cs_ file). For the validation to work, the DataGrid should be cast to the model type and its columns should be declared using the `AddFor()` method.
The DataGrid UI component supports data validation against a set of predefined or custom validation rules. These rules are generated based on Data Annotations that decorate the model properties (see the _EmployeeValidation.cs_ file). For the validation to work, the DataGrid should be cast to the model type and its columns should be declared using the `AddFor()` method.

The [AdditionalFields](https://learn.microsoft.com/en-us/aspnet/core/mvc/models/validation?view=aspnetcore-8.0#additional-fields) property of the Remote attribute allows you validate combinations of fields against data on the server.

In this demo, the data validation process will not be successfully completed if an already existing email is entered. To accomplish that, apply a Remote attribute to Email and include ID in AdditionalFields. The validation parameter will then have access to both ID and Email, which allows you to compare them with source data.

0 comments on commit 07830ec

Please sign in to comment.