The checkbox is not displaying in page. I tried many solutions in google. Nothing worked. Here s the code:
@model project.gamestatus
@using (Html.BeginForm("Create", "Calculator", FormMethod.Post, new { id = "frmID" }))
{
//other codes
<div class="form-group">
@Html.Label("Show on Screen", htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.CheckBoxFor(m => m.display_status)
@Html.ValidationMessageFor(model => model.display_status, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-info" />
</div>
</div>
}
Only if the checkbox is shown in page i can proceed with validation. In my view there is no checkbox
CheckBoxFor()
method that will generate the html (a<input type="checkbox" .. />
and a<input type="hidden" ... />
) for the property which you can easily verify by inspectinh the page source. If you not seeing it visually, then you probably have an issue with your css.