This is a migrated thread and some comments may be shown as answers.

Grouping using SelectListItems

1 Answer 23 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Alex asked on 09 Mar 2017, 11:06 PM

Is there any support for using SelectListItems as a datasource for ComboBoxes?

I would like to use it to do grouping, but I am unsure how to group where my datasource is a list of SelectListItems:

The following causes an error When I try to group on the Group's Name. Any other way of doing it?

<div class="demo-section k-content">
          .HtmlAttributes(new { style = "width:100%;" })
          .DataSource(source =>  source
              .Group(g => g.Add("Group.Name", typeof(string)))
              .Transport(transport => transport
                .Read(read =>
                    read.Action("Customers_Read", "ComboBox")
    function onAdditionalData() {
        return {
            text: $("#customers").val()

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 13 Mar 2017, 10:54 AM
Hello Alex,

I am afraid that the structure of the SelectListItems class does not fit to the scenario, where a grouping could be achieved with the ComboBox. In order to achieve the desired functionality, using SelectListItem, you should extend the class by adding the Name property.

public class MySelectListItem: SelectListItem
    public string Name { get; set; }

Then, you will be able to group by the Name property.

Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question