This is how Html.CheckBox was designed!
It always assists <input name="test" type="checkbox" value="true" />
then followed by <input name="test" type="hidden" value="false" /> .
When you submit the form with the checkbox selected, you will receive test=true,false , and if the checkbox is not selected, you will receive test=false .
This is how it maintains binding to the boolean value, because the ,false part ,false ignored. However, if you are attached to something else (for example, string ), it means that you will see the value "true,false" .
If you need other behavior, you will have to use your own Html.CheckBoxAlt method. Here's a similar question, along with some code that I wrote some time ago: Passing a checkbox selection into action
Scott Rippey Dec 08 '11 at 20:29 2011-12-08 20:29
source share