Friday, 15 July 2022

MVC - Display Nullable checkbox


Watch this example on YouTube:

 


Replace

    @Html.CheckBoxFor(x => x.MyQuestions)

with


    @Html.CheckBox("MyQuestions", Model.MyQuestions ?? false)