Is there a way to make a Radio Button enabled/disabled (not checked/unchecked) via CSS?
I’ve need to toggle some radio buttons on the client so that the values can be read on the server, but setting the ‘enabled’ property to ‘false’ then changing this on the client via javascript seems to prevent me from posting back any changes to the radio button after it’s been enabled.
See: ASP.NET not seeing Radio Button value change
It was recommended that I use control.style.add(‘disabled’, ‘true’) instead, but this does not seem to disable the radio button for me.
Thanks!
To the best of my knowledge CSS cannot affect the functionality of the application. It can only affect the display. So while you can hide it with css (display:none) you can’t disable it.
What you could do would be to disable it on page load with javascript. There are a couple ways to do this but an easy way would be to do something like
and put that in your .aspx file at the top below the body tag.