In my model i have the following property.
public bool? ShowDocumentNumber { get; set; }
when i try to show it on the razor view
@Html.CheckBoxFor(model =>model.ShowDocumentNumber)
I get the following error.
Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?)
when i try to cast it
@Html.CheckBoxFor(model =>bool.Parse(model.ShowDocumentNumber.ToString()))
i get the following error at run time.
Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
How can i display the checkbox on the razor view?