I have an html helper checkbox on a view in an MVC3 project:
<%
var temp = Model.NonResident;
if (Model.NonResident)
Html.CheckBox("IsNonResident", true);
else
Html.CheckBox("IsNonResident", false);
%>
The model field 'NonResident does have a value of true. I assigned the value to 'temp' and stepped through it. When I debug, the codee does hit the Html.CheckBox("IsNonResident", true) segment but it doesn't render.
I've checked 'View Source' and the control is not there. If I remove the 'if' statement, it does render if I use:
<%=Html.CheckBox("IsNonResident", true)%>
It must be something simple but I can't see it. Can anyone help?