Input Validation

 
First Name Last Name Title Courtesy Title Birth Date Hire Date
NancyDavolioSales RepresentativeMs.12/8/19785/1/2005
AndrewFullerVice President, SalesDr.2/19/19658/14/1992
JanetLeverlingSales RepresentativeMs.8/30/19854/1/2002
MargaretPeacockSales RepresentativeMrs.9/19/19735/3/1993
StevenBuchananSales ManagerMr.3/4/195510/17/1993
MichaelSuyamaSales RepresentativeMr.7/2/198110/17/1999
RobertKingSales RepresentativeMr.5/29/19601/2/1994
LauraCallahanInside Sales CoordinatorMs.1/9/19853/5/2004
AnneDodsworthSales RepresentativeMs.1/27/198011/15/2004
Data grid with 9 rows and 7 columns
0 rows are selected

Our Blazor Grid uses the standard DataAnnotationsValidator to validate user input (based on data annotation attributes defined in an edit model). The Grid validates editor values once a user moves focus away from data editors or uses a command that saves changes. In EditCell mode, the grid control validates user input when focus moves away from the edited row. The control prevents users from editing a different row until they address all validation errors.

You can implement your custom validator components and declare them in the CustomValidators template. To disable input validation, set the ValidationEnabled option to false.

DevExpress Blazor data editors implement the following validation settings:

In this demo, you can use checkboxes in the Grid toolbar to enable/disable validation and show/hide successful validation results. The Edit Mode combo box allows you to switch between edit modes.

Note: You should not rely on form validation alone to secure your Blazor-powered app. Form validation is only designed to improve application usability. A threat actor can bypass validation and send malicious data to the server. To minimize security related threats/risks, you must track data changes using multiple strategies. Refer to the following topic for more information: Validate User Input.