KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a EF entity that is tied to a SQL table that contains a bit field called "Active". I generate the Edit code from the T4 template, and the page inherits from the EF entity. At the bottom of the page, it generated a CheckBoxFor like this: <%= Html.CheckBoxFor(model => model.Active) %> I get the wonderful red squiggly under model.Active, and the error message says that I cannot implicitly convert type bool? to bool. So, I tried the following: <%= Html.CheckBoxFor(model => (bool)model.Active) %> It, of course, didn't like that and gave me this error: System.InvalidOperationException: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions. I'm probably missing something simple.
Tags (comma-separated)
Save Edits
Cancel