开发者

Disable RadioButtonList from code-behind and enable it using javascript

开发者 https://www.devze.com 2023-02-07 18:20 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消