Disable a checkbox in javascript and recognize it as checked on the server side
asp.net, checkbox, javascript
Solution
Any disabled control inside a form will not submitted to server on post back. You can add a hidden input control and put the checkbox state to that input and server side check that hidden input value.
Problem
I have a checkbox which in some cases may be disabled and checked using javascript, i.e: ``` var cbTest = document.getElementById("CheckBoxTest"); cbTest.disabled = true; cbTest.checked = true; ``` However, when sending a postback, `CheckBoxTest.Checked` is false on the server side. Is it possible to disable the checkbox and still have the server side recognize it as checked?