Boolean with html helpers

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2010-03-08T09:45:52Z Indexed on 2010/03/08 9:51 UTC
Read the original article Hit count: 346

What's up with this? The viewmodel variable is a bool with value true.

<%= Html.HiddenFor(m => m.TheBool) %>
<%= Html.Hidden("IsTimeExpanded",Model.TheBool) %>
<input type="hidden" value="<%=Model.TheBool%>" name="TheBool" id="TheBool">

Results in:

<input id="TheBool" name="TheBool" value="False" type="hidden">
<input id="TheBool" name="TheBool" value="False" type="hidden">
<input value="True" name="TheBool" id="TheBool" type="hidden">

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about html-helper