Disable Linkbutton using javascript RRS feed

  • Question

  • Hi,

       I have requirement to disable or enable  linkbutton on click of checkbox(un checked event) by default , when page loads linkbutton  should be  disabled.

    Please let me know if any code snippet or solution for this. it should be done through javascript.





    Tuesday, August 2, 2011 8:37 AM


  • This code might help you

    <html xmlns="http://www.w3.org/1999/xhtml">
      <script type="text/javascript">
        function validate() {
          var check = document.getElementById('cbEnable');
          if (!check.checked)
            document.getElementById('lnkEnable').disabled = true;
            document.getElementById('lnkEnable').disabled = false;
      <form id="form1" runat="server">
      Enable/Diable Link Button :<input type="checkbox" onclick="validate()" id="cbEnable" />
      <asp:LinkButton ID="lnkEnable" Enabled="false" runat="server">Link Button</asp:LinkButton>


    • Proposed as answer by Sankarsan Parida Wednesday, August 3, 2011 9:50 AM
    • Marked as answer by Cookie Luo Friday, August 5, 2011 2:29 AM
    Tuesday, August 2, 2011 10:46 AM