Is there a simple way to use the existing Html Helpers to generate a list of checkboxes with explicit values (as was possible in Beta)?
Example in Beta (possibly with MVC Contrib):
.CheckBox("Field", 6, new { value = 6})
would output:
<input id="Field1" type="checkbox" value="6" name="Field" />
<input id="Field2" type="hidden" value="6" name="Field" />
yet in RC2 I get:
<input id="Field1" type="checkbox" value="6" name="Field" />
<input type="hidden" value="false" name="Field" />
NB: I use a custom helper extension that generates unique HTML
id
s and sets the checked HTML attribute when appropriate
Besides using raw HTML and not using Html Helpers is there a way of setting checkboxes
with explicit values? Looking at the Codeplex source code for RC2 there doesn't appear to be an easy way as .InputHelper()
is marked private
so you can't use it to help.
NB: There's more than one checkbox
in the page to allow multiple selection, so the false
value is of no use, as I need the values from the hidden field to know which items were ticked and which weren't (as non-checked checkbox
values aren't posted - only the hidden fields are).