views:

23

answers:

1

I have two controls ControlEdit and ControlView with some inputs and checkbox and two views ReadOnly and Edit, I was using MvcContribn checkbox helper to make checkbox disable I did set attribute disable to true on defaultView(here I am loading ControlView) by default user chant make any changes on that view, then if user click change button he comes to edit view (ControlEdit) and here everything enabled.

For some reason every time on EditView check box became unchecked. I was trying to use default check box html helper - the same story.

On edit view it is always becoming unchecked. When I remove disable true attribute on ViewControl then it is became working and in that case check box does not loosing his state on EdivVew.

Then I was using jQuery to set checkbox disable, didn't help. I did look different browsers the same story everywhere. I am getting correct behavior only when i does not setting disable to true on ReadOnly view. May be somebody come across that. Need help.

+1  A: 

-FIXED-

Finally I fixed that. I wrapped checkbox in to div and make checkbox disable inside div like that:

$('#DivWrapper :input').attr("disabled", true)

bigb
You can also use an element which already wraps all checkboxes, all other elements are filtered out anyway by ":input".
Fabian