I have a class named "AirLineSession":
public ExtendedList listCo { get; set; }
public ExtendedList listBa { get; set; }
public bool SortbyRating { get; set; }
public AirLineSession()
{
listCo = new ExtendedList();
listBa = new ExtendedList();
}
In my view I have:
@Html.HiddenFor(m => m.listBa)
@Html.HiddenFor(m => m.listCo)
@Html.DropDownListFor(a => a.SortbyRating, new[] { new SelectListItem { Text = "Sort by rating", Value = "true" }, new SelectListItem { Text = "Sort by frice", Value = "false" } })
When I summit this view, only data of SortByRating is passed to the model in Controller, listBa and listCo aren't passed. I don't know why.
Anyone help me, thanks.
Could you post the code of ExtendedList class? The reason is the asp.net mvc does not know how to create all Hiddens for the ExtendedList complex type. In this case, you should add hiddens for each field of object and collection for both collections, for sample:
And also: