Cascading DropDownLists

2 posts, 0 answers
  1. Jillian
    Jillian avatar
    16 posts
    Member since:
    Aug 2011

    Posted 13 Sep 2012 Link to this post

    I am trying to follow the example code of a cascading combobox here for some cascading drop down lists I need. I have 3 total drop down lists, just as in the example.  The first cascading drop down is working fine. The only problem with the first cascading drop down is that my "optionlabel" is ignored completely.   The second does not work at all.  What's wrong with my second cascading drop down list, and how do I pass my vehicle type and my make to the action to get my models? Here are my drop down lists.

    <script type="text/javascript">
        function VehicleType() {
            return {
                VehicleType: $("#VehicleType").val()
            };
        }
        function Make() {
            return {
                Make: $("#Make").val()
            };
        }
    </script>

    <%: Html.Kendo().DropDownListFor(i => i.VehicleType)
                    .Name("VehicleType")
                    .BindTo(new SelectList(Model.DemographicValues, "ValidValue""ValidValueLabel"))
                    .OptionLabel("Please Select")
                    .HtmlAttributes(new {Style="Width:200px;"})%>


    <%: Html.Kendo().DropDownListFor(i => i.Make)
                    .Name("Make")
                    .DataTextField("Make")
                    .DataValueField("Make_Code")
                    .DataSource(source => {
                        source.Read(read =>
                            {
                                read.Action("GetCascadeMakes""Home")
                                    .Data("VehicleType");
                            })
                            .ServerFiltering(true);
                        })
                    .OptionLabel("Please Select")
                    .CascadeFrom("VehicleType")
                    .Enable(false)
                    .AutoBind(false)
                     %>


    <%: Html.Kendo().DropDownListFor(i => i.Model)
                    .Name("Model")
                    .DataTextField("Model")
                    .DataValueField("ModelCode")
                    .DataSource(source => {
                        source.Read(read =>
                            {
                                read.Action("GetCascadeModels""Home")
                                    .Data("Make");
                            })
                            .ServerFiltering(true);
                        })
                    .CascadeFrom("Make")
                    .Enable(false)
                    .AutoBind(false)
                     %>
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 18 Sep 2012 Link to this post

    Hello Jillian,

     
    The issue related to the "OptionLabel" is not a known one. I will need a repro test project in order to review it locally. The code snippet looks OK. I will need to review the server implementation. Thus I will be able to find the cause of the issue. I will also suggest you check the "Cascading DropDownLists" demo. You can find the project in %Install folder%\Telerik\Kendo UI for ASP.NET MVC Q2 2012\Examples. You can also review this help topic, which describes how the cascading functionality works.

    Regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top