listbox with checkboxes

人走茶凉 提交于 2019-12-06 13:37:32

问题


Greetings, in my asp.net mvc application I have a listbox rendered as follows:

<%= Html.ListBox("localization", (Model as SeekWeb.Models.CreateMessageViewModel).Localizations.AsEnumerable())%>

is there any way to have checkbox for each listbox item? if checkbox is checked then the appropriate listbox item is selected.


回答1:


I use a funky little jQuery plugin - jQuery Multiselect - to turn listboxes into more user friendly checkboxes. It's themeroller ready too!

Yeah, it does rely on the user having JS enabled but it does degrade gracefully to the standard listbox.

HTHs,
Charles




回答2:


Checkboxes aren't part of the standard listbox. If you need checkboxes you'll probably need to use a grid of some kind. MVCContrib has a grid control that's pretty good.



来源:https://stackoverflow.com/questions/2673883/listbox-with-checkboxes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!