Html.CheckBoxFor() checked problem in ASP.Net MVC 2

Posted by inolen on Stack Overflow See other posts from Stack Overflow or by inolen
Published on 2010-05-03T16:12:15Z Indexed on 2011/11/30 9:50 UTC
Read the original article Hit count: 239

Filed under:
|
|

It doesn't seem that the Html.CheckBoxFor helper adds the correct "checked" attribute when rendering the HTML.

I have a bool property rendered like so:

<%= Html.CheckBoxFor(m => m.Visible) %>

And the outputted HTML is this:

<input type="checkbox" value="true" name="Visible" id="Visible">

Is there some particular reason it does not add the "checked" attribute when the value is true?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET