I want to use checkbox
in dropdownlist
so we can check multiple value from it and later we can use that checkbox
value. Is there any way to achieve it?
Asked
Active
Viewed 1,526 times
2

Mark
- 2,041
- 2
- 18
- 35

Kinjal Patel
- 420
- 1
- 12
- 20
-
2What about using a `ListBox` with `SelectionMode="Multiple"`? – Pikoh Sep 05 '16 at 09:37
-
@Pikoh No there are data like Person Name come from database, so i don't think so listbox can help with that. – Kinjal Patel Sep 05 '16 at 09:49
-
I've never seen a drop down list of checkboxes. I can't see that this would have any use – JKerny Sep 05 '16 at 09:49
-
@JeremyKern , I want to select multiple person name at once from dropdownlist later i can use it or process it. So i wonder if there is a way something like this. – Kinjal Patel Sep 05 '16 at 09:52
-
I don't get what the problem of data coming from database is with using a `ListBox`...maybe you could explain it – Pikoh Sep 05 '16 at 09:55
-
@Pikoh I agree that listbox can do help with multiple selection option but with amount of data listbox will be lenghty. So thats why i say no to listbox, but if there is any way to handle this problem in listbox then i will appreciate it. – Kinjal Patel Sep 05 '16 at 10:00
-
1you do know that a listbox can use scrollbars, do you? :) – Pikoh Sep 05 '16 at 10:01
-
@Pikoh i completely forgot that , thanks to remind me that, and yeah it is better way to do it – Kinjal Patel Sep 05 '16 at 10:06
-
@Pikoh i will use your suggestion as an alternative option, but i would like to know if there is any way to use checkbox in dropdownlist, anyway thank you for your precious suggestion. Thank you very much. – Kinjal Patel Sep 05 '16 at 10:10
-
1Have a look at [this](http://www.aspsnippets.com/Articles/DropDownCheckBoxes-ASPNet-DropDownList-CheckBoxList-Server-control.aspx) but i haven't tried it. And you're welcome :) – Pikoh Sep 05 '16 at 10:13
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/122650/discussion-between-kinjal-patel-and-pikoh). – Kinjal Patel Sep 05 '16 at 10:15
2 Answers
1
Have you tried adding the multiple attribute?
<select name="cars" multiple>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>

JKerny
- 488
- 1
- 3
- 19
-
i want to use it in asp.net and i don't think so that _dropdownlist_ contain such property like that – Kinjal Patel Sep 05 '16 at 10:42
-
1
-
sure i m gonna use that as your and pikoh's suggestion, but also want to see dropdownlist option as an alternative. – Kinjal Patel Sep 05 '16 at 12:00
1
There is no standard HTML element do this, but you can build your own using asp.net as a new control if you are on asp.net forms, or you can write a custom HTML element and make it look like a drop down.
Also there are many plugins and libraries do exactly this such as:
https://github.com/davidstutz/bootstrap-multiselect
jQuery multiselect drop down menu

Community
- 1
- 1

Amr Elgarhy
- 66,568
- 69
- 184
- 301