A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://demos.telerik.com/aspnet-core/grid/editing-custom below:

Custom Editing in ASP.NET Core Grid Component Demo

  1. Components /
  2. Grid /
  3. Custom Editing
ASP.NET Core Grid Custom Editing

Loading Demo...

Files:

editing_custom.cshtml

Editing_CustomController.cs

ProductService.cs

ClientCategory.cshtml

CategoryViewModel.cs

ProductViewModel.cs

ForeignKeyColumnController.cs

BaseService.cs

Editing_Custom_TagHelper.cshtml

Also available for:

CLIENT-SIDE API HTML HELPER API TAG HELPER API Description

Some scenarios require the ASP.NET Core DataGrid not only visualize data in a table structure, but also to support editing and validation before users save changes.

The Telerik UI for ASP.NET Core Grid allows you to implement CRUD data-editing operations by setting its data source. To enable the data-editing capabilities of the component:

  1. Set the Editable configuration property of the Grid—.Editable(editable => editable.Mode(GridEditMode.InCell)).
  2. Specify a unique field in the Model as the DataSource.Model.Id.
  3. Configure the DataSource of the Data Grid for performing CRUD data operations by defining its Read, Create, Update, and Destroy methods.

To allow the insertion of new Data Grid records, you need to add the New Record button in the toolbar of the component—.ToolBar(toolbar => toolbar.Create()).

To enable the Delete command on each row, insert a new column—columns.Command(command => { command.Destroy(); });.

This demo shows how to further customize the editor for the Category field which is an object (a complex type). To make sure that the Data Grid uses the custom editor, add the editor to the ~Views\\Shared\\EditorTemplates folder, for example, @(Html.Kendo().DropDownListFor(m => m).

To ensure that the Grid invokes the custom editor:

  1. Decorate the model property with the UIHint attribute.

    [UIHint("ClientCategory")]

    public CategoryViewModel Category { get; set;}

  2. Specify a default value that will be used initially when an item will be created:

    model.Field(p => p.Category).DefaultValue(ViewData["defaultCategory"] as Kendo.Mvc.Examples.Models.CategoryViewModel);

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

Additional Apps

This Grid example is part of unique collection of hundreds of ASP.NET Core demos, with which you can see all

Telerik ASP.NET Core 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

Telerik REPL for ASP.NET Core

or

ThemeBuilder

.

Support & Learning Resources Additional Resources

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4