How to pass Additional parameter in Kendo Multi select

1 Answer 42 Views
MultiSelect
Developer
Top achievements
Rank 1
Developer asked on 29 Jan 2022, 03:54 AM

I want to load positions based on selected employee.

Index.Cshtml

$("#employees").kendoMultiSelect({
                placeholder: "Select employees...",
                dataTextField: "EmployeeFullName",
                dataValueField: "EmployeeId",
                autoBind: false,
                filter: "contains",
                dataSource: { 
                    serverFiltering: true,
                    transport: { 
                        read: baseUrl + "Schedules/GetEmployees_New",
                    }
                }
            }).data('kendoMultiSelect');
             
           $("#positions").kendoMultiSelect({
                placeholder: "Select positions...",
                dataTextField: "Code",
                dataValueField: "PositionId",
                autoBind: false,
                filter: "contains",
                dataSource: {
                    serverFiltering: true,
                    transport: {
                        read: baseUrl + "Schedules/GetPositions_New",
                        data: function () {
                           return {
                                IDs : $("#employees").data('kendoMultiSelect').value().join() //I am not getting this value in controller
                            };
                        }
                    }
                }
            }).data('kendoMultiSelect');

 

SchedulesController.cs

        public ActionResult GetEmployees_New(Filters filter, string IDs)
        {
            return Json(ReturnData, JsonRequestBehavior.AllowGet);
        }
        public ActionResult GetPositions_New(Filters filter, string IDs)
        {
            // I am not getting employee value in IDs parameter.
            return Json(ReturnData, JsonRequestBehavior.AllowGet);
        }

 

Model
    public class Filters
    {
        public string logic { get; set; }
        public DateTime? FromDate { get; set; }
        public DateTime? ToDate { get; set; }
        public List<Filter> filters { get; set; }

        public bool IsDailyHours { get; set; }
    }
Any help would be much appreciated.
Developer
Top achievements
Rank 1
commented on 02 Feb 2022, 05:18 AM

I have tried below option also,

 

transport: {
                         read: baseUrl + "Schedules/GetPositions_New?IDs=" + $("#employees").data('kendoMultiSelect').value().join() //I am not getting this value in controller
                    }

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 02 Feb 2022, 09:46 AM

Hello, Res,

If I correctly understand the scenario, you wish to have cascading MultiSelects. If that is the case, please review this How-To article on the subject.

Let me know if that would be helpful to you.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Developer
Top achievements
Rank 1
commented on 03 Feb 2022, 02:51 AM

I will try this solution today.
Tags
MultiSelect
Asked by
Developer
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or