R2 2018 Release is here – now with modern UI for chatbots and more! See what’s new!
Change Theme

SASS Themes

    LESS Themes

      SASS Theme Builder

      Create new or customize SASS themes
      Launch Theme Builder

      Grid / Custom validator editing

      Description

      In numerous scenarios there is a requirement to not only visualize data in a table structure, but also to edit and validate it before save changes.

      The Telerik for ASP.NET Core DataGrid helper supports CRUD data editing operations via a simple configuration of its data source. All you have to do to enable its data editing capabilities is to:

      • Set the grid's editable configuration option: .Editable(editable => editable.Mode(GridEditMode.InLine))
      • Specify a unique field in the Model as the DataSource Model Id
      • Configure the DataSource for performing CRUD data operations defining its Read, Create, Update and Destroy actions
      • To enable the Edit command on each row insert a new column: columns.Command(command => { command.Edit(); });

      When the ASP.NET Core Grid is put in edit mode, a Kendo UI Validator is automatically enabled and ready to apply rules to the currently edited model or field in accordance with the HTML attributes in the form. The validation rules which are part of ASP.NET Core will be automatically inserted as attributes from the CustomValidationProductViewModel - such as the [Required] attribute. However, when a special rule is required, use the approach as shown in the script below.

      In this demo you can see how to extend the built-in Kendo UI Validator with a custom rule.

      The sample demonstrates a check for the first capital letter for the ProductName column, when you edit the value in it.



      More about the client-side Kendo UI Validator

      More about theTelerik Grid for ASP.NET Core

      ASP.NET Core source

      Also available for:

      • editing_custom_validation.cshtml
      • Editing_Custom_ValidationController.cs
      • ProductService.cs
      • CustomValidationProductViewModel.cs

      Support & learning resources

      Grid for other technologies