I am trying to create a cascading effect with 2 comboboxes.
The first combobox contains states and the second contains cities in those states. When the user chooses a state, the second combobox should only display cities that are in that selected state.
I am trying to clear the datasource and reset it, but I am not having much luck.
Is it possible to do what I am trying to do?
Thanks!
Bobby
Just checking back in. Does anyone have any insight into how I could go about implementing this?
Hello Striker8118,
I just developed a sample demonstrating this.
I am attaching the sample here,
Download it and let me know your comments.
Looking forward to hear from you.
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Hi Georgi,
Thank you for a sample.I tested that with few adjustments (with few adjustments, see below) and it worked as you probably expected.When item in country-combo was selected, then second combo appeared with cities which corresponded to selected country. When selection in country-combo was cleared, then city-combo disappeared.
Notes:1. You probably use old version of Infragistics.Web.Mvc dll. The latest/new version will have implementation of combo, editors and rating similar to rules used by standard Mvc controls such as TextBox, DropDownList, etc. Those controls will expect that model contains named member/field. That rule will be applied to Combo(id), ComboFor(model), TextEditor(id), TextEditorFor(model), etc.The old empty constructor without named field will be still supported as a remainder from old version. That usage will be not advisable and it will not have support for persistance after a postback.If application will attempt to use ComboFor(model) or Combo(id) without member in model, then exception will be raised.
2. In order to run your sample, I replaced ComboFor(model => model[0].igCombo2)byCombo()Considering structure of your model (List) it is possible to use (better to say "misuse") ComboFor with something likeComboFor(model => model[0].igCombo2)Assuming that DropDownItem will have igCombo2 member. Something likepublic class DropDownItem{ public string Country { get; set; } public string City { get; set; } public string igCombo2 { get; set; } ...}So, I tested those cases.