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

Cascading DropDownLists

3 Answers 531 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jillian
Top achievements
Rank 1
Jillian asked on 13 Sep 2012, 01:23 PM
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)
                 %>

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 18 Sep 2012, 07:39 AM
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!
0
AppDev
Top achievements
Rank 1
answered on 22 Jun 2017, 07:18 PM

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

 

0
Dimitar
Telerik team
answered on 27 Jun 2017, 02:00 PM
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.
Tags
DropDownList
Asked by
Jillian
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
AppDev
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or