How to get the checked checkbox from a ASP.NET MVC2 form
- by JF
I have a hard time in asp.net MVC2 trying to get the checked values of different checkbox.
Here is my view
    <div id="RoleSelection">
    <ul>
        <% foreach (var roles in Model.Roles)
           { 
        %>
        <li>
            <input type="checkbox" id="roles" value="<%: roles %>" /> <%: roles %>
        </li>
        <%   
            }
        %>
    </ul>
</div>
My model:
    [LocalizedDisplayName("Role", NameResourceType = typeof(UserResources))]
    public string Role { get; set; }
    public IEnumerable<string> Roles { get; set; }
So basically here I'm trying to figure out how to get all the checked checkbox from my form!
Thank you