I followed the instructions for the list and tried to process the selections correctly. What throws me and I can’t find the right material is access to the selected values. There can be only one selected, but most likely there will be several selected at a time.
my postcontroller receives the object model and does it matter one of the selected elements, but not all of them? Should I run some jquery before post, as other articles have said? It seems wrong, but maybe ...
My model:
public partial class ExtrnlSubsModel : BaseEntityModel
{
public IList<SelectListItem> AvailableForums { get; set; }
public int ExtForumId { get; set; }
}
My razor:
@Html.ListBoxFor(model => model.ExtForumId, Model.AvailableForums, new { style = "width:500px;height:250px" })
@Html.RequiredHint()
@Html.ValidationMessageFor(model => model.ExtForumId)
My controller:
[HttpPost]
public ActionResult ExtForumAdd(ExtrnlSubsModel model)
{ .... }
So, as I mentioned, my model is populated, but with only one choice, despite the ctrl-clicked multiple elements.
TIA