title: Disabling asp validation controls in a hidden Panel
body: <p>In my asp page I used 2 asp panel controls.The second panel was <strong>not visible</strong> as the style property of it was set to hidden.Panel 2 is displayed through javascript code which change the style property to <strong>visible</strong> according to the value of a <strong>checkbox</strong> in panel 1.
  On postback although the <strong>panel 2</strong> is hidden its asp validations are pop up and the postback is not happening.I tried to disable the server <strong>controls</strong> via javascript,but its not working.</p>
  
  <p>Can someone help me in this?</p>
  
  <pre><code>function DisablePanel() {
  var div_to_disable =document.getElementById('&lt;%=Panel1.ClientID%&gt;').getElementsByTagName("input");
  var children = div_to_disable;
  for (var i = 0; i &lt; children.length; i++) {
  children[i].disabled = true;
      };
  }
  function EnablePanel() {
  var div_to_disable = document.getElementById('&lt;%=Panel1.ClientID     %&gt;').getElementsByTagName("input");
      var children = div_to_disable; //.childNodes;
      for (var i = 0; i &lt; children.length; i++) {
          children[i].disabled = false;
      };
  }
     function ShowPanel2() {
     var panel = document.getElementById('&lt;%=Panel2.ClientID %&gt;');
     if (panel.style.visibility == 'hidden') {
         EnablePanel();
         panel.style.visibility = 'visible';
     }
     else { DisablePanel();
         panel.style.visibility = 'hidden';
  } 
  </code></pre>