Abstracting the interpretation of MVC checkboxes values received by the FormsCollection object
- by Simon_Weaver
In ASP.NET MVC a checkbox is generated by the HtmlHelper code here:
<%= Html.CheckBox("List_" + mailingList.Key, true) %>
as this HTML:
<input id="List_NEW_PRODUCTS" name="List_NEW_PRODUCTS" type="checkbox" value="true" />
<input name="List_NEW_PRODUCTS" type="hidden" value="false" />
In case you're wondering why is there an…