Hello,
I try to make a view in ASP.NEt mvc 2 with a selectList.
I fill up the selectlist languages from my model (regDom)
listLangModel is a list of languages I retrieve from the database.
regDom.Languages = from l in listLangModel
select new SelectListItem { Text = l.Name, Value = l.ID };
In my view I have this
<div class="editor-label"> <%: Html.LabelFor(model =>> model.Languages) %> </div> <div class="editor-field"> <%: Html.DropDownListFor(model => model.Languages, Model.Languages) %> <%: Html.ValidationMessageFor(model => model.Languages) %> </div>
When I run, the languages are in the dropdownlist on my page. But when I post it back to my server, the model doesn't contain the languages anymore. And I can't check which language is selected on the page.