In the construction of my View, I have a field of type:
public bool? RegistoGesOleos { get; set; }
What I represent using Razor as:
@Html.CheckBoxFor(model => model.RegistoGesOleos.Value)
Now when I do submit
of my Form, and I try to get the value of the field in Controller (using FormCollection):
var teste = form["ConcluidoGesOleos.Value"];
I get as:
"true, false"
Edit: When I inspected elements on my page, I noticed that two input's are created:
<input data-val="true" data-val-required="The Value field is required." id="ConcluidoGesOleos" name="ConcluidoGesOleos.Value" type="checkbox" value="true">
<input name="ConcluidoGesOleos.Value" type="hidden" value="false">
Why does this happen and how can I get around it in the right way?