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

Cascade Dropdown not working

1 Answer 353 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Joanna
Top achievements
Rank 1
Joanna asked on 30 Jun 2020, 06:35 PM

Hi, I have a problem trying to populate my child dropdown. My parent dropdown is able to be populated but once I select it, my child dropdown is still empty. I feel like the problem is once i add in ".data("filterState")" it somehow breaks. My breakpoint is hit if I do not add .data but once I add that, my breakpoint doesn't hit my controller.

 

        <td class="alignright">@Html.LabelFor(m => m.SchoolStateID, "State:", new { @class = "input-label" })</td>
        <td colspan="1" style="text-align:left">
            @(Html.Kendo().DropDownList()
                                .Name("SchoolState")
                                .HtmlAttributes(new { @class = "input-sm form-control" })
                                .OptionLabel("Select State")
                                .DataTextField("State")
                                .DataValueField("Id")
                                .DataSource(source =>
                                {
                                    source.Read(read =>
                                    {
                                        read.Action("GetStateList", "Client");
                                    });
                                })
                                        .Enable(true)
                                        .AutoBind(true)
                                 )  
        </td>
    </tr>
    <tr>
        <td class="alignright">@Html.LabelFor(m => m.CityID, "City:", new { @class = "input-label" })</td>
        <td colspan="1" style="text-align:left">
            @(Html.Kendo().DropDownList()
                                .Name("SchoolCity")
                                .HtmlAttributes(new { @class = "input-sm form-control" })
                                //.OptionLabel("Select City")
                                .DataTextField("City")
                                .DataValueField("Id")
                                .DataSource(source =>
                                    {
                                        source.Read(read =>
                                        {
                                            read.Action("GetCityList", "Client")
                                            .Data("filterCity");
                                        })
                                        .ServerFiltering(true);
                                    })
                                        .Enable(false)
                                        .AutoBind(false)
                                        .CascadeFrom("SchoolState")
                                )
        </td>

 

<script>
    function filterCity() {
        console.log($("#SchoolState").val());
        return {
            schoolstate: $("#SchoolState").val()
        };
    }

</script>

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 02 Jul 2020, 11:33 AM

Hello Joanna,

Attached you will find a small project with cascading DropDownLists. Could you please modify it to reproduce any issues you are experiencing? I will then debug the solution and happily assist you.

Looking forward to your reply.

Regards,
Martin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
DropDownList
Asked by
Joanna
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or