Jan 15, 2015, 2:26 PM
(MVC) Not getting the MultiComboFor value at action methods
Hi,
my Model attribute bind to MultiComboFor is not carrying any data to action method. It is always returning emtry List ( of the Model Bind Attribute)
My Model looks like
my Model attribute bind to MultiComboFor is not carrying any data to action method. It is always returning emtry List ( of the Model Bind Attribute)
My Model looks like
public class FacilityViewModel : BaseModel
{
public IEnumerable<ListItem> Blocks
{
get;
set;
}
..................
}
The Controller public ActionResult saveFacilityData(FacilityViewModel facilityModel)
{
domain.Hostel hostel = new domain.Hostel();
hostel.HostelName = facilityModel.HostelName; --> this is okay
facilityModel.Blocks ---> this is Empty List
}
My cshtml X.MultiComboFor(m=>m.Blocks).ID("drpBlocks").Name("Blocks").LabelWidth(100)
.TypeAhead(true)
.QueryMode(DataLoadMode.Local)
.ForceSelection(false)
.TriggerAction(TriggerAction.All)
.DisplayField("Block")
.ValueField("BlockID")
.EmptyText("Select Blocks...")
.Store(X.Store()
.Model(X.Model()
.IDProperty("BlockID")
.Fields(
new ModelField("BlockID", ModelFieldType.String) { Mapping = "BlockID" },
new ModelField("Block", ModelFieldType.String) { Mapping = "Block" }
)
)
.DataSource(Model.BlockList)
Any clue, what i am doing wrong ?