4

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 Answers 2

6

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

Sign up to request clarification or add additional context in comments.

Comments

1

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)

1 Comment

I have eight options of something, the number of the thing can grow dynamically. I use these options on the top of a page to filter some results accordingly. There are many filtering areas and I want to lower the row count for this option's selection to one and also users want to see all the available selections.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.