New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Using AutoComplete as Custom Column Editor

Environment

ProductGrid for Progress® Telerik® UI for UI for ASP.NET Core

Description

How can I use the Telerik UI for ASP.NET Core AutoComplete as a custom column editor for the Grid in Telerik UI for ASP.NET Core?

Solution

  1. Create an editor template within the following directory - "~\Views\Shared\EditorTemplates"
  2. Pass the newly created view name to the following column configuration :
Razor
columns.Bound(p => p.ProductName).EditorTemplateName("CustomEditorName");

Example

Index.cshtml

@(Html.Kendo().Grid<GridExample.Models.ProductViewModel>()
    .Name("Grid")
    .Columns(columns => {
        //columns.Bound(p => p.ProductName).EditorTemplateName("AutoCompleteEditor");
        columns.Bound(p => p.ProductName).EditorTemplateName("ComboBoxEditor");
        columns.Command(command => command.Destroy());
    })
    .Pageable()
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Scrollable()
    .ToolBar(t => { t.Create(); t.Save(); })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)
        .PageSize(20)
        .ServerOperation(false)
        .Model(model => model.Id(p => p.ProductID))
        .Create("Create", "Grid")
        .Read(r=>r.Action("Read", "Grid"))
        .Update(u=>u.Action("Update", "Grid"))
        .Destroy("Destroy", "Grid")
    )
)

More ASP.NET Core Grid Resources

See Also