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

MultipleCascade 2

2 Answers 58 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
william
Top achievements
Rank 1
william asked on 28 Feb 2012, 11:01 AM
HI All,

Here's the background to my problem. I have a table Made up of uniqueId with a Foreign key of ManufacturerId, then I have things like Model, cc, Year Of Manufactuer.

Now I have a cascade Combo of:
@(Html.Telerik().ComboBox()
                                      .Name("Manufacturer")
                                      .BindTo(new SelectList(Model.ManufacturerTypes, "Value", "Text"))
                                      .Placeholder("-- Select --")
                                      .CascadeTo("Dropdown_Model")
                                      )
@(Html.Telerik().ComboBox()
                                      .Name("Dropdown_Model")
                                      .DataBinding(binding => binding.Ajax().Select("GetDropDownModels", "RoadRisk"))
                                      .Placeholder("-- Select --")
                                      .CascadeTo("Dropdown_Year")
@(Html.Telerik().ComboBox()
                                      .Name("Dropdown_Year")
                                      .DataBinding(binding => binding.Ajax().Select("GetDropDownYears", "RoadRisk"))
                                      .Placeholder("-- Select --")
                                      .CascadeTo("Dropdown_CC")
                                      )
                                      )

Now My first dropdown shows my manufacturers ok and then my Models are also shown no Problem, (all this info is in 1 table it cannot be normalised further to make life easier). My problem is that by the time I get to populating my Years, I've lost the manufacturer Id. since the PK is being passed down. So I select 'Ford' for manufacturer and 'Capri' for model, but when it returns my different years of manufacture for capri I receive invalid years, because at this point I cannot use the ManufacturerID, and so I get Capri's by other Manufacturers also being returned. What I really want to do is pass my Original Manufacture ID from the parent dropdown to the child

2 Answers, 1 is accepted

Sort by
0
william
Top achievements
Rank 1
answered on 28 Feb 2012, 12:06 PM
Ok,

Solved it.

On the Combo introduce a client event:
.ClientEvents(events => events.OnDataBinding("onDropdown_Year"))
then in script something like:
function onDropdown_Year(e) {
        e.data = $.extend({}, e.data, { manufactureID: $("#Manufacturer").attr("value") });
    }
Then in the controller :
public JsonResult GetDropDownYears(int? Dropdown_Model, int manufactureID)
0
comgiu
Top achievements
Rank 2
answered on 10 Oct 2012, 03:06 PM
thanks so much

PS: mark as answer ;-)
Tags
ComboBox
Asked by
william
Top achievements
Rank 1
Answers by
william
Top achievements
Rank 1
comgiu
Top achievements
Rank 2
Share this question
or