2

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
  • not sure if this is related but the actual HTMLCheckbox that a browser renders can not be set as readonly (you can disable it though) Commented Aug 17, 2010 at 13:23

1 Answer 1

1

-FIXED-

Finally I fixed that, I wrapped checkbox in to div and make checkbox disable inside div like this

$('#DivWrapper :input').attr("disabled", true)
Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.