Groups | Blog | Home
all groups > asp.net > february 2006 >

asp.net : Unable to re-enable a radio button if disabled server-side



xazos79
2/28/2006 10:23:42 PM
Hi All,

I've come across the problem of not being able to re-enable a radio
button with javascript if its initial state has been disabled in the
Page_Load() method of the code behind.

Might i add that it behaves fine in Firefox, but IE is unable to
re-enable the radio button. IE is fine if the radio button starts in an
enabled state.

Version of IE i'm using is 6, and i have also tried with IE7 and got
the same result.

Is this a bug specific to IE ?

Any help would be appreciated, thanks.


- Sam
Madhusudhan
3/1/2006 12:00:00 AM
[quoted text, click to view]
========================

Hi There

<script>
function enable()
{
var controls = document.getElementsByTagName("input");
NumElements = controls.length;

for (i=0;i<NumElements;i++)
{
if(controls[i].name=="rdEnable")
{
controls[i].setAttribute("disabled" , false);
ParentSpanControl = controls[i].parentElement;
ParentSpanControl.setAttribute("disabled" , false); break;
}
}

return false;
}
</script>

Explanation:
============
A DotNet Radio Button Control will result in creation of the following
three controls

1.Span Control
2.Input Type=Radio
3.Label



So using javascript , do identify all the controls that radio button is
rendered to and set their disabled propery to false;

xazos79
3/1/2006 3:17:38 PM
Cheers for the reply. I might give your suggestion a try. As a work
around i just used some javascript and registerd it in the codebehind
as a startup script to perform the enabling/disabling. Seems to work
fine.
AddThis Social Bookmark Button