Checkbox to Control Button Enabled Property - ASP.NET

后端 未结 3 708
深忆病人
深忆病人 2021-01-28 17:06

I would like to know how I can control the \'Enabled\' property of a button based on the \'checked\' value of a checkbox:



        
3条回答
  •  面向向阳花
    2021-01-28 17:51

    You can use here ClientID attribute so you can get the control on client side via javascript using document.getElementById or document.forms[0].elements[clientID].

    function enableButton() {
    
    $get('<%= btnLoadForm.ClientID %>').disabled = !$get('<%= chkEnableButton.ClientID %>').checked;
    
    }
    
    
    

提交回复
热议问题