Hi!
I have a ASP.NET MVC application where I have a HTML.Listbox where the user can add items to it, in the webpage. It looks like this.
<p>
<label for="groups">Grupper:</label>
<%= Html.ListBox("RoleGroups", (Model != null ? new SelectList(Model.RoleGroups) : new SelectList(new List<BL.Portal.Domain.Model.RoleGroup>(){})))%>
<%= Html.ValidationMessage("RoleGroups")%>
<br /><input type="button" id="btnRemoveRoleGroup" name="brnRemoveRoleGroup" value="Ta bort gruppen" /> <input type="button" id="btnAddRoleGrop" name="btnAddRoleGrop" href="#dialogAddRoleGroup" value="Lägg till en grupp" />
</p>
And in the Controller I recevie the information like this.
[RequiresRole(RoleToCheckFor = RoleEnum.UserCreate)]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult CreateEdit(Model.User user, bool newUser, string confirmedpassword)
But in my User the Properties RoleGroups is always Null so I check the Request.Form.AllKeys and can't find the key: RoleGroups in there. So I guess the information about the Html.Listbox is never sent when I do the postback!
What have I missed?