5
In the construction of my View, I have a field of the kind:
public bool? RegistoGesOleos { get; set; }
Who 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 the Controller (using Formcollection):
var teste = form["ConcluidoGesOleos.Value"];
I receive as:
"true, false"
Edit: When inspecting items on my page, I found 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 it happens and how can I get around in the right way?
Exactly, that’s what’s happening
– CesarMiguel
check out how to treat.
– Jonny Piazzi
that’s exactly what ;)
– CesarMiguel