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 2010/05/09 5:48 UTC
Read the original article Hit count: 1177

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 ASP.NET

Related posts about asp.net-mvc