Answered by:
How to select multiple value from drop down list?

Question
-
User-552477072 posted
Hi
I am in trouble in multiple drop down selection.
My drop down is as:
Controller:
public ActionResult DropDownBox(string dropdownbox) { ModelVariables model= new ModelVariables(); model.dropDownList = dropdownbox; return this.View("Index", model); }
View Portion:
@using (Html.BeginForm("DropDownBox", "Home", FormMethod.Get)) { @Html.DropDownList("dropdownbox", ) <button type="submit"></button> } <p>@Model.dropDownList</p>To select multiple items which portion I should update? Can anyone help me? Thanks for your help!
Friday, November 30, 2018 3:13 AM
Answers
-
User-1823088829 posted
You can use helpers:
- Html.ListBox(..)
- Html.ListBoxFor(..)- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, November 30, 2018 5:32 PM -
User1520731567 posted
ListBoxFor() can use for selection. But I was asking for Multiselect. Any idea? ThanksYou won't be able to do it with a dropdownlist directly but what you could do is fake it.
If you would like to Multiselect,you could use ListBox or other plugins to achieve Multiselect.
Using ListBox,you could refer to:
https://www.codeproject.com/Articles/771999/ASP-Net-MVC-How-to-create-a-ListBox
https://forums.asp.net/t/2146573.aspx
Also,you could use other plugins,such as:
Bootstrap Multiselect:
http://davidstutz.de/bootstrap-multiselect/
Multi-select boxes in select2:
https://select2.org/getting-started/basic-usage
Best Regards.
Yuki Tao
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, December 3, 2018 7:32 AM
All replies
-
User-1823088829 posted
You can use helpers:
- Html.ListBox(..)
- Html.ListBoxFor(..)- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, November 30, 2018 5:32 PM -
User-552477072 posted
ListBoxFor() can use for selection. But I was asking for Multiselect. Any idea? Thanks
Monday, December 3, 2018 7:12 AM -
User1520731567 posted
ListBoxFor() can use for selection. But I was asking for Multiselect. Any idea? ThanksYou won't be able to do it with a dropdownlist directly but what you could do is fake it.
If you would like to Multiselect,you could use ListBox or other plugins to achieve Multiselect.
Using ListBox,you could refer to:
https://www.codeproject.com/Articles/771999/ASP-Net-MVC-How-to-create-a-ListBox
https://forums.asp.net/t/2146573.aspx
Also,you could use other plugins,such as:
Bootstrap Multiselect:
http://davidstutz.de/bootstrap-multiselect/
Multi-select boxes in select2:
https://select2.org/getting-started/basic-usage
Best Regards.
Yuki Tao
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, December 3, 2018 7:32 AM