How to binding to bit datatype in SQL to Booleans/CheckBoxes in ASP.NET MVC 2 with DataAnnotations

Posted by nvtthang on Stack Overflow See other posts from Stack Overflow or by nvtthang
Published on 2010-05-07T07:20:32Z Indexed on 2010/05/07 7:38 UTC
Read the original article Hit count: 254

Filed under:
|

I've got problem with binding data type boolean to checkbox in MVC 2 data annotations Here's my code sample:

label>
Is Hot
</label>
<%=Html.CheckBoxFor(model => model.isHot, new {@class="input" })%>

It always raise this error message below at (model=>model.isHot).

Cannot convert lambda expression to delegate type 'System.Func<Framework.Models.customer,bool>' because some of the return types in the block are not implicitly convertible to the delegate return type

Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?)

Please suggest me how can I solve this problem?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about asp.net-mvc