title: Accessing <div> from both javascript and code-behind
body: <p>I have a div with style="display:none". The div should become visible on pressing an html button:</p>
  
  <pre><code>function JSAdd() {
      document.getElementById('divDetail').style.display = "block";
  }
      &lt;div style="float:left"&gt;
  
      &lt;div id="ctl00_MainContent_upnlLbRD"&gt;
  
  
  
  
  
              &lt;select size="4" name="ctl00$MainContent$lbRD" id="ctl00_MainContent_lbRD" style="width:188px;"&gt;
  
      &lt;option value="5"&gt;one&lt;/option&gt;
      &lt;option value="1"&gt;two&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>    &lt;input id="btnAdd" type="button" value="Добавить" onclick="JSAdd();" /&gt;
      &lt;input id="btnEdit" type="button" value="Редактировать" onclick="JSEdit();" /&gt;
  &lt;/div&gt;
  &lt;div id="ctl00_MainContent_divDetail" style="display:none" clientidmode="static"&gt;
      &lt;div id="ctl00_MainContent_upnlDescription"&gt;
  
              &lt;div&gt;
  
                  &lt;span id="ctl00_MainContent_lblDescription"&gt;Описание:&lt;/span&gt;
  
                  &lt;input name="ctl00$MainContent$txtDescription" type="text" id="ctl00_MainContent_txtDescription" /&gt;  
  
                  &lt;span id="ctl00_MainContent_txtDescriptionRequiredFieldValidator" style="color:Red;visibility:hidden;"&gt;Описание является обязательным для заполнения&lt;/span&gt;
  
              &lt;/div&gt;
  
              &lt;input type="submit" name="ctl00$MainContent$btnSave" value="Сохранить" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&amp;quot;ctl00$MainContent$btnSave&amp;quot;, &amp;quot;&amp;quot;, true, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, false, false))" id="ctl00_MainContent_btnSave" /&gt;   
  </code></pre>
  
  <p>
      </p>
  
  <p>I need to be able to make the div invisible again from code-behind. I cannot access the div unless it is <code>runat="server"</code>. But when I add runat="server", the div doesn't become visible on pressing the button from the javascript function above. Could you please help me with this?</p>
  
  <p>Thanks,<br>
  David</p>