kendo UI multi select bind one list value to change another multi select list

1.4k views Asked by At

ok so I am trying to grab the value from a kendo ui multi select list and then change the array in a secound list based on whats being returned from a MVC controller post back

this is the post back, which returns a Json object

[HttpPost]
        public ActionResult findProfileSettings(string selectedID)  
        {
            var profiles_msl = obtainProfilesMethod(selectedID);

            ViewBag.Profiles_msl = new List<Profiles>(profiles_msl);

            var result = new List<Profiles>(profiles_msl);

            return Json(result);
        }

This is the post back via aJax,

scv = scv.substring(0, scv.length - 6);
            $.ajax(
                {
                    type: "post",
                    url: '@Url.Action("findProfileSettings", "Account")',
                    contentType: "application/json; charset=utf-8",
                    a: scv,
                    data: JSON.stringify({ selected: scv }),
                    cache: false,
                    error: function (data) {
                        alert("Error");
                    },
                    success: function (data)
                    {
                    for (x in data)      
                    {

                        var markUp;
                        markUp = "<option value=" + data[x]["ID"] + ">" + data[x]["profiles"] + "</option>";
                        $("#ID").html(markUp).show();                            
                    }                        
                }
            })

the data being sent back in the full list and works but I am having issues biding this back to the kendo multi select

this is the first multi select list

  @(Html.Kendo().MultiSelect()
                    .Placeholder("Select ")                    
                    .MaxSelectedItems(1)    
                    .Name("list")
                    .Value(new[] { new { } })
                    .HtmlAttributes(new
                    {
                        id = "MSL",
                        data_bind = " options: list, optionsText: 'ID', optionsValue: 'cid'"
                    })
                    .Events(e =>
                    {
                        e.Change("onChange");                                                
                    })                   
                )

and this is the one that need to change

  @(Html.Kendo().MultiSelect()
                    .Placeholder("Select Profiles")
                    .Name("Profiles")
                    .Value(new[] { new { } })
                    .HtmlAttributes(new
                    {
                        id = "ID",
                        data_bind = "options: Profiles_msl, optionsText: 'profiles', optionsValue: 'ID'"
                    })
                )

I think the issues is in how im building the multi select any help thanks

1

There are 1 answers

0
AlanMorton2.0 On

The kendo UI multiselect hasn't got the 'cascading from' element so this current isn't possible.