i have checkbox in my which is like this @Html.CheckBoxFor(model => model.SKUs.Jewish)
but my Jewish in database is nullable
type so it gives me an error cannot implicitly convert type 'bool?' to 'bool'
. how do check my model that it has values then it should show that else not.please help.
You could use the following:
@Html.CheckBox("SKUs.Jewish", Model.SKUs.Jewish.GetValueOrDefault());
If the value is not set it uses the nullable types default value which is false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With