Mar 04, 2013, 11:16 AM
[CLOSED] Cascading combo box Fuctionality.
Hi,
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.
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.
Html.X().ComboBoxFor(ad=>ad.DataCategoryId)
.ID("DataCategory")
.Padding(5)
.Editable(false)
.DisplayField("Data_Category_Desc")
.ValueField("Data_Category_Id")
.QueryMode(DataLoadMode.Local)
.TriggerAction(TriggerAction.All)
.SelectOnFocus(true)
.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)
.ID("DataType")
.DisplayField("Data_Type_Desc")
.ValueField("Data_Type_Id")
.EmptyText("Loading...")
.ValueNotFoundText("Loading...")
.Store(Html.X().Store()
.ID("CmbStore")
.AutoLoad(false)
.Model(Html.X().Model()
.IDProperty("Data_Type_Id")
.Fields(
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; }
}
Last edited by Daniil; Mar 07, 2013 at 9:53 AM.
Reason: [CLOSED]