user2328252
user2328252

Reputation: 13

Kendo cascading dropdown loading dropdown based on other drop down selection

I am planning of using a cascading kendo drop down. Drop down 1 - Countries - it will list down all the countries. Drop down 2 - States - Based on the selection of the country I have to show the states here.

The data for both are loaded from my api controllers. I referred to this link http://demos.kendoui.com/web/dropdownlist/cascadingdropdownlist.html

But, I need to pass the first selected value to the second drop down. PLease suggest the best way to do it. Examples would be really helpful.

Thanks.

Upvotes: 1

Views: 3751

Answers (1)

HaBo
HaBo

Reputation: 14297

you have to use events for that http://demos.kendoui.com/web/dropdownlist/events.html

.Events(e =>
            {
  e.Change("change").Select("select").Open("open").Close("close").DataBound("dataBound");
            })

 <script>
      function change() {
          // get a reference to the dropdown list
var dropdownlist = $("#dropdownlistTwoForStates").data("kendoDropDownList");
//Write your logic here to bind data for thie dropdown
// disable the dropdown list
dropdownlist.enable(true);
        };
    </script>

Upvotes: 3

Related Questions