How can I get the results from a JQUery Multi-select dropdownlist as called per an mvc3/razor?
http://abeautifulsite.net/blog/2008/04/jquery-multiselect/
Actually, you can also recieve the selected values by adding a parameter to your action.
For instance, lets say you have following listbox:
//Controller GET
public ActionResult ManageUsers()
{
ViewBag.Users = new SelectList(repository.GetAllUsers(), "Id", "Email");
return View();
}
//View
@Html.ListBox(ViewBag.Users as SelectList, new { @id = "users" })
//Controller POST
[HttpPost]
public ActionResult ManageUsers(List users)
{
//Manage all the selected users which will appear in the List.
return View()...
}
I believe you can have an array as type instead of a generic list aswell, havn't tried it myself though, the key however is to name the parameter the same as the html element id for the listbox.