I am using ASP.Net MVC 4 in VB.Net, I have seen a few other answers for how to make a checkbox for a nullable Boolean in c# . Usually converting to VB.Net is pretty straight forward. This I can not figure out.
Other answers say to do this..
make a Boolean.cshtml in my EditorTemplates folder and sticking
@model bool?    
@Html.CheckBox("", Model.GetValueOrDefault())
So, I tried the VB equivelent, in EditorTemplates folder I made Boolean.vbhtml and put this
@model System.Nullable(of Boolean)
@Html.CheckBox("", Model.GetValueOrDefault)
then in my view I have
@Html.EditorFor(Function(x) x.myNullableBool)
That code throws this exception:
Object variable or With block variable not set.
there are a few different places I found with pretty similar c# examples very similar to what is posted here. Does anyone know how to get this to work in VB.Net?
EDIT
This is kind of what I'm trying to do (if it worked it'd be even better)
@model System.Nullable(of Boolean)
@Html.CheckBox("", If(Model is Nothing, False, Model))