Input Validation

 
First Name Last Name Title Title Of Courtesy Birth Date Hire Date
Nancy Davolio Sales Representative Ms. 12/8/1978 5/1/2005
Andrew Fuller Vice President, Sales Dr. 2/19/1965 8/14/1992
Janet Leverling Sales Representative Ms. 8/30/1985 4/1/2002
Margaret Peacock Sales Representative Mrs. 9/19/1973 5/3/1993
Steven Buchanan Sales Manager Mr. 3/4/1955 10/17/1993
Michael Suyama Sales Representative Mr. 7/2/1981 10/17/1999
Robert King Sales Representative Mr. 5/29/1960 1/2/1994
Laura Callahan Inside Sales Coordinator Ms. 1/9/1985 3/5/2004
Anne Dodsworth Sales Representative Ms. 1/27/1980 11/15/2004
Data grid with 9 rows and 7 columns

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.