3

Just moved from WebForms to MVC and replacing various userinterfaces. Not sure how the WebForms CheckListBox is implemented, is there a jQuery plugin or a basic example of this somewhere?

1 Answer 1

4

Depending on your need for jQuery, a template similar to this is what I routinely use. (You should be able to wire up jQuery events to this; I'm keeping this to a basic template for now.)

<div class="checkBoxList"><!-- This class usually defines a max-height and overflow -->
    <% foreach (MyObject o in Model.MyObjects) { %>
        <input type="checkbox" name="myObjectSelections" 
            value="<%=o.Value%>" /><br />
        <%=o.Text%>
    <% } %>
</div>

(I may refine this answer in a couple hours once I'm at work and see my real code for this, but it should get you started.)

Your action method for this will take an array of bools for the myObjectSelections argument.

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

1 Comment

@John Rudy: Thats Great I thought it may just be checkboxes within a scrollable div...

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.