I 开发者_JAVA百科have a scenario where a RadioButtonList needs to be in disabled mode by default and then on some event on client side, say, when a checkbox is checked, it needs to be enabled.
But once I disable it from code-behind, the javascript part of enabling it doesn't work.
Am I missing something or is it not possible?
Try this:
function Test()
{
var controlObject = document.getElementById('RadioButtonList1');
controlObject.removeAttribute('disabled')
RecursiveDisable(controlObject);
return false;
}
function RecursiveDisable(control)
{
var children = control.childNodes;
try{control.removeAttribute('disabled')}
catch(ex){}
for (var j = 0; j < children.length; j++) {
RecursiveDisable(children[j]);
//control.attributes['disabled'].value = '';
}
}
taken from: http://forums.asp.net/t/1259735.aspx
Hope this helps
精彩评论