Edit this page

Configure Server Grouping and Sorting in MultiSelect

Environment

Product Progress Kendo UI MultiSelect for ASP.NET MVC

Description

How can I enable the server-side grouping and sorting for the Kendo UI MultiSelect in ASP.NET MVC projects?

Solution

  1. Enable sorting and grouping. Indicate by which field the data will be sorted and grouped. Define schema.data.

    @(Html.Kendo().MultiSelect()
        .Name("multiselect")
        .DataTextField("Name")
        .DataValueField("Name")  
        .DataSource(source => source
            .Custom()
            .Type("aspnetmvc-ajax")
            .ServerGrouping(true)
            .ServerSorting(true)
            .Sort(s => s.Add("Name"))
            .Group(g => g.Add("TypeP", typeof(string)))
            .Transport(transport => transport
            .Read(read =>
            {
                read.Action("GetProducts", "Home");
            }))
            .Schema(s => s
                .Data("Data")
                .Model( m => m.Id("Id"))
            )
        )
        .Placeholder("Select product...")
    )
    
  2. In the controller action, handle the DataSourceRequest.

        public JsonResult GetProducts([DataSourceRequest]DataSourceRequest request)
        {
            var productss = ProductsAll().ToDataSourceResult(request);
            return Json(productss);
        }
    

See Also

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy