Where do the contents of the combobox on the Telerik demo ASP.NET Core Grid Custom Editing are coming from?

1 Answer 31 Views
ComboBox Grid
Alexandre
Top achievements
Rank 1
Iron
Alexandre asked on 08 Jan 2024, 10:06 PM

Hello,

I am trying to build a grid that has a combobox in it that should be filled from an Ajax request. But based on the demo on the page, I am not being able to determine where the combobox is filled.

I appreciate any help on the matter.

Regards,

Alexandre

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 11 Jan 2024, 09:16 PM

Hi Alexandre,

Based on the phrasing of your question I suppose that you are looking to add a ComboBox Editor for a column of the Grid.

To achieve this you can either specify a UIHint within the Model

        [UIHint("ClientCategory")]
        public CategoryViewModel Category
        {
            get;
            set;
        }

or configure the EditorTemplateName property of the Grid's Column.

.Columns(c=>{
             c.Bound(x=>x.Category).EditorTemplateName("ClientCategory"));    
})

These configuration will search for a View in the Views/Shared/EditorTemplates directory of the project and will use the Component configured in that View as the Editor for the column.

ClientCategory.cshtml

@model Kendo.Mvc.Examples.Models.CategoryViewModel

        @(Html.Kendo().ComboBoxFor(m => m)
              .DataTextField("CategoryName")
              .DataValueField("CategoryID")
              .HtmlAttributes(new { style = "width:100%"; data_bind="value: Category" })
              .DataSource(source => source
                    .Ajax()
                    .Read(read =>
                        {
                            read.Action("ActionName","ControllerName");
                        })
                    )
              )
        )
I hope the information above is insightful.

Regards,
Stoyan
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tags
ComboBox Grid
Asked by
Alexandre
Top achievements
Rank 1
Iron
Answers by
Stoyan
Telerik team
Share this question
or