title: Setting style.display from asp.net c#
body: <p>I am using a Panel in an ASP.NET webpage to hide or display a selection of control in response to a client side button click. Simple script toggles the visibility</p>
  
  <pre><code>&lt;script&gt;
      function SetToAddSurvey() {
  
      var x = document.getElementById("NewSurveyPanel");
      if (x.style.display == "none") {
          x.style.display = "block";
      } else {
          x.style.display = "none";
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I now need to toggle the display property on the server side following a database transaction. I know I can't use the code </p>
  
  <pre><code>NewSurveyPanel.visible = false; 
  </code></pre>
  
  <p>as it will cause the control to not be rendered and the above jscript to fail when it is called next.</p>
  
  <pre><code>NewSurveyPanel.Attributes["display"] = "block";
  </code></pre>
  
  <p>also doesn't work.</p>
  
  <p>Is there an easy solution for this?</p>
  
  <p>Ta.</p>