Html.CheckBox returns false if disabled, even if seleced

I don't know if it solves your problem but this was the solution for me:

My model has an UserMigrated boolean property, once the user has setted to migrated, he can't go back, so the view becomes:

@if (Model.UserMigrated)
    {
    <td>@Html.CheckBox("chkBoxReadOnly", true, new {disabled = "disabled"})</td>
        @Html.HiddenFor(m => m.UserMigrated)
    }
else
    {
    <td>@Html.CheckBoxFor(m => m.UserMigrated)</td>
    }

An input field marked with the disabled="disabled" attribute NEVER sends its value to the server. If you want to achieve this you could use the readonly="readonly" attribute which still prevents the user from modifying the value but sends the existing value when the form is submitted.


1) From my point of view there is no way to change the behavior of the Html.CheckBox method. I had to face the problem time ago and i ended up with manually constructing the input checkbox as you suggest. To construct the input checkbox is not always the hell as using the helper methods is not always the eaven. Of course biulding your own helper method can be the right choise.

2) Disabled input field is not posted when form is submitted; i would expect the same, submiting disabled input checkbox fileds, whether are checked or not.

We can argue about the choice adoped to relay on input hidden field for pushing into the request the checkbox, when the checkbox is not selected. The side effect of this choice is that we will find the checkbox name among the the posted data even if the checkbox is disable in disagreement with what stated above that is: disabled input field is not posted when form is submitted