Okay, right now I have a form that contains this select list:
<%=Html.LabelFor(x => x.Id)%>
<%= Html.ListBoxFor(x => x.Ids, new SelectList(Model.Items, "ID", "Name", Model.Ids)) %><br />
And here is my controller, where I add the data to the database:
foreach (var id in model.Ids)
{
tool.ToolItems.Add(new ToolItem { ID = id });
}
Now, I decided to use checkboxes instead of a selectlist, here is that code:
<% foreach (var item in Model.Tools)
{ %>
<input type="checkbox" name="tool" value="<%= item.ID %>" />
<%= tool.Name %>
</>
<% } %><br />
I have no idea what to do in my controller tho to get all the selected checkboxes.
Sorry if some of the variables dont make sense, I tried to change it as consistently as possible since I cant post the actual stuff.