New to Telerik UI for ASP.NET MVC? Download free 30-day trial

ASP.NET MVC Grid Custom Validator Editing

Loading Demo...
  • EXAMPLE
  • VIEW SOURCE
editing_custom_validation.cshtml
Editing_Custom_ValidationController.cs
ProductService.cs

Also available for:

CLIENT-SIDE API SERVER-SIDE API

Description

Some scenarios require the Telerik UI for ASP.NET MVC Data Grid not only to visualize data in a table structure, but also to support editing and validation before users save changes.

By design, the Grid has a built-in Validator that is initialized when a specified row is in edit mode. Each property that binds to an editable Grid column is validated based on how it is defined in the Model. For example, if the field is required, if its data type is correct, and more. You can extend the default validation rules of the Grid's Validator and perform additional client-side validations.

This demo shows how to extend the Grid built-in Validator and define a custom validation rule by using the jQuery extend() method. The productnamevalidation() function checks for a first capital letter of the ProductName field column when editing.

For more information about the editing capabilities, refer to the official Telerik UI for ASP.NET MVC Data Grid product documentation on the available data-editing approaches.

Additional Apps

This Grid example is part of a unique collection of hundreds of ASP.NET MVC demos, with which you can see all Telerik ASP.NET MVC components and their features in action. View the source code of the demos from the library or directly adapt, and edit them and their theme appearance in the ThemeBuilder.

Support & Learning Resources

Additional Resources