title: Using ASP.NET to Hide an HTML Div
body: <p>I am using ASP.NET for a web page in order to make some server calls that involve looking up user organization information. Based on that information, we need to either hide or display a div. In the header I have a C# function that definitely runs. I have tried the following lines to hide the div.</p>
  
  <pre><code>divID.Style.Add("display","none");
  </code></pre>
  
  <p>and</p>
  
  <pre><code>divID.Visible = false;
  </code></pre>
  
  <p>In the body, I am currently using an asp:Panel that runs at server and contains the id "divID". No matter what I do, I can't get the div to hide (without manually putting the styling in). I tried putting the scripts before and after the body, and it didn't make a difference. Any suggestions on the best way to do this would be appreciated.</p>
  
  <p>EDIT:</p>
  
  <p>Here is the C# initiating code.</p>
  
  <pre><code>&lt;script runat="server" language="C#"&gt;
    void getUserInfo(Object sender, EventArgs ev){
  </code></pre>
  
  <p>The rest of the C# code is irrelevant, but the relevant line shown above is definitely being run.</p>
  
  <p>The HTML portion looks something like this.</p>
  
  <pre><code>&lt;asp:Panel runat="server" id="divID" style="width:200px; height:130px; "&gt;
     &lt;div style="text-align:center"&gt;Test Data&lt;/div&gt;
  &lt;/asp:Panel&gt;
  </code></pre>