Cascading Multi Select Issue

2 posts, 0 answers
  1. Ajay
    Ajay avatar
    1 posts
    Member since:
    Jun 2016

    Posted 04 Jul Link to this post

    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 

     

     

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    141 posts

    Posted 05 Jul Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top