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

Cascading Multi Select Issue

1 Answer 271 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Ajay
Top achievements
Rank 1
Ajay asked on 04 Jul 2016, 10:21 AM

Hi 

I am trying to Cascade a Multi select from a drop down list and am having issues getting the value of the dropdown list to pass into the controller.

My Drop down code is: 

 

    <h4 style="margin-top: 2em;">Sub Sub Category:</h4>
    @(Html.Kendo().DropDownList()
          .Name("category3")
          .OptionLabel("Select Sub Sub Category")
          .DataTextField("Description")
          .DataValueField("Id")
          .DataSource(source =>
          {
              source.Read(read => { read.Action("GetCategory3", "CampaignSimple").Data("filterCategory3"); }).ServerFiltering(true);
          })
          .Enable(false)
          .AutoBind(false)
          .CascadeFrom("category2")
          .Events(e => e.Select("select"))
         

 )
    <script>
        function filterCategory3() {
            
            return {
                category2: $("#category2").val()
            };
        }
    </script>

 

And my MultiSelect code is:

    <h4 style="margin-top: 2em;">Ad Group</h4>
    @(Html.Kendo().MultiSelect()
          .Name("adgroup")
          .Placeholder("Select AdGroup")
          .DataTextField("Description")
          .DataValueField("Id")
          .DataSource(source =>
          {
              source.Read(read => { read.Action("GetAdGroups", "CampaignSimple").Data("filterAdGroups"); }).ServerFiltering(true);
          })
          .AutoBind(false)
          .Enable(false)

          )

    <script type="text/javascript">

        function filterAdGroups() {
 
        return {
            category3: $("#category3").val()
        };
    }

    function select(e) {
        var dropdownlist = $("#category3").data("kendoDropDownList");
        dropdownlist.select(e.item.index());

        var multiselect = $("#adgroup").data("kendoMultiSelect");
        multiselect.dataSource.read();
        multiselect.enable(true);
    };
    </script>

When I select an item from the drop down list it does go into the the controller method but the parameter is always null.

Any ideas?

 

Thanks in advanced 

 

 

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 05 Jul 2016, 11:31 AM
Hello,

Are you sure the parameter in the controller is named as in the filter function (in the MultiSelect's case "category3")? On my machine the GetAdGroups(string category3) method receives the correct Id of the selected item from the DropDownList.

If the parameter is named correctly and the problem persists, would you please isolate the problem in a sample runnable project and attach it in a support ticket?

Regards,
Peter Milchev
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
MultiSelect
Asked by
Ajay
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or