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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With