View Full Version : [CLOSED] Cascading combo box Fuctionality.

Mar 04, 2013, 11:16 AM

In below code I have Model in which there are two list DataCategory List and another is DataType list. On selection of Data category I want to have Data Type.With the example shown in the link http://mvc.ext.net/#/Form_ComboBox/Ajax_Linked_Combos/
there is a call which pull the data and fill the combo but in my case I already have the data into the DataType list.

So I just need to write the condition on the list.I tried to write the condition inside DataSource property of the DataType combo.
but here App.DataCategory.getValue() is not working as App is not recognized here. Can you help in getting the value of DataCategory Combo in this condition.

.EmptyText("Select Category")
.Listeners(ls =>
ls.Select.Handler = "App.DataType.clearValue(); App.DataType.getStore().load())")
.Items((from dataCategory in Model.DataCategoryList select new Ext.Net.ListItem
{ Text = dataCategory.Data_Category_Desc, Value = dataCategory.Data_Category_Id.ToString() })

Html.X().ComboBoxFor(um => um.DataTypeId)
new ModelField("Data_Type_Id", ModelFieldType.String) { Mapping = "Data_Type_Id" },
new ModelField("Data_Type_Desc", ModelFieldType.String) { Mapping = "Data_Type_Desc" }
.DataSource(Model.DataTypeList.Where(um => um.Data_Category_Id == 1))

MODEL:- AddNewDataFileDTO

public class AddNewDataFileDTO
public int DataCategoryId { get; set; }
public string DataCategory { get; set; }
public int DataTypeId { get; set; }
public string DataType { get; set; }

public List<DataCategoryDTO> DataCategoryList { get; set; }
public List<DataTypeDTO> DataTypeList { get; set; }

Mar 04, 2013, 2:38 PM
Hi @alscg,

Do you want to bind data this way initially or on user choice (I mean selecting an item by a user)?

If the first, I think you should get a key directly from a Model.

If the second, I think it is not possible, because the view is already rendered. You will have to reload a Store as it is done in the example you mentioned.