Html.CheckBox Specify Class

2019-07-05 15:37发布

How do we specify the class of Html.CheckBox ?

I am trying something like this, but this doesn't work.

   @Html.CheckBox("chk_", abc.IsChecked, new { @class="checkbox" })

THanks !!

1条回答
来,给爷笑一个
2楼-- · 2019-07-05 16:36

When specifying class, compiler puts a check to confirm that the bool value is not nullable, i fixed the datatype from null-able bool to bool, and it ran fine.

@Html.CheckBox("chk_", abc.IsChecked, new { @class="checkbox" })

查看更多
登录 后发表回答