Cascading DropDownLists

4 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
    3725 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. AppDev
    AppDev avatar
    6 posts
    Member since:
    Mar 2015

    Posted 22 Jun Link to this post

    I am having major issues trying to get Cascading Dropdownlists working in a inline edit with core. I followed the example KendoGridWithInlineCascadingComboBoxes but it does not work it appears the the Grind OnChange event fires AFTER the .Data call for the action of the second dropdown

     .Columns(columns =>
                      {
                          columns.Bound(p => p.FieldNameIn);
                          columns.ForeignKey(p => p.FieldTable, Model.FieldTable, "FieldTable", "FieldTableName").EditorTemplateName("FieldTables");
                          columns.ForeignKey(p => p.FieldNameOut, Model.FieldNameList, "FieldNameOut", "FieldNameOutName").EditorTemplateName("FieldNamesOut");

    When I select FieldTables The fieldNameOut dropd down tries to fire the Get FieldTable value and it always fails as Null

     

  4. Dimitar
    Admin
    Dimitar avatar
    209 posts

    Posted 27 Jun Link to this post

    Hello Travis,

    May I ask you to provide an isolated runnable example where the described issue is demonstrated? This way I will be able to review the server-side implementation and provide you with further assistance regarding the specific scenario.

    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top