views:

78

answers:

2

Hi,

Is it possible to create a dropdown box in ASP.NET MVC, that has a checkbox alongside each item in the dropdown list?

I know it sounds simple, in webforms or using telerik this would be pretty simple, but I can't figure how I can implement the same thing in basic HTML.

Thanks

+2  A: 

a dropdown with each element of the dropdown having a checkbox? that's not a standard element of HTML, why would you even need that? a multiple option is what you need:

http://www.htmlcodetutorial.com/forms/_SELECT_MULTIPLE.html (first one)

Stefanvds
+2  A: 

You can use a jQuery plugin called DropDownCheckList to get the wanted effect of a dropdownlist with multiselect options.

alt text

Its pretty easy, all you need to do is to create a html listbox and call the jQuery plugion to extend the listbox.

<script type="text/javascript">
    $(document).ready(function() {
        $("#listbox").dropdownchecklist();
    }
</script> 

<select id="listbox" multiple="multiple">
                <option>Option 1</option>
                <option>Option 2</option>
                <option>Option 3</option>
            </select>

http://dropdown-check-list.googlecode.com/svn/trunk/doc/dropdownchecklist.html

QuBaR
very cool... jQuery FTW
quakkels