I often use the built in CheckBox HtmlHelper as it allows me to easily specify the checked state of the element like this
@Html.CheckBox("Test",Model.IsChecked);
vs creating it on the view like so
@if(Model.IsChecked)
{
<input id="test" type="checkbox" checked="checked" />
}
else
{
<input id="test" type="checkbox" />
}
However when inspecting the html generated by the helper i can see it renders this html.
<input id="Test" name="Test" type="checkbox" value="true" />
<input name="Test" type="hidden" value="false" />
I can't work out why there is a hidden field input as well, what is it used for?