我的视图有一个从我的viewmodel中选择元素(选项).
@using (Html.BeginForm("NewUser","Admin")) { <select multiple="" id="inputRole" class="form-control" size="6" name="inputRole"> @foreach (var item in Model.roller) { <option>@item.Name</option> } </select> }
如何在Controller中获取所选值?
[HttpPost] public ActionResult NewUser(FormCollection formCollection) { String roleValue1 = formCollection.Get("inputRole"); }
这给了我一个空值.