title: asp.net controlIDs
body: <p>I have the following code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;    
  
      Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandle);
      Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandle);
      function beginRequestHandle(sender, Args) {
          //Do something when call begins. 
  
          document.getElementById("btn1").style.visibility = "hidden";
          document.getElementById("btn2").style.visibility = "hidden";
      }
  
      function endRequestHandle(sender, Args) {
          if (document.getElementById('&lt;%= hfResultsCount.ClientID %&gt;').value != 0) {
              document.getElementById("btn1").style.visibility = "visible";
              document.getElementById("btn2").style.visibility = "visible";
          }
          else {
              document.getElementById("results").innerHTML = "&lt;br&gt;&lt;b&gt;&lt;center&gt;&lt;font style='font-family:Haettenschweiler; font-size:xx-large'&gt;No data found, please try again.&lt;/b&gt;&lt;/font&gt;&lt;/center&gt;";
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>and the code for btn2:</p>
  
  <pre><code> &lt;input type="button" runat="server" name="btn2" id="btn2" value="New Window"
   style="visibility:hidden;font-weight:bold;width:200" onclick="window.open('http://microsoft.com');" /&gt;
  </code></pre>
  
  <p>I am using Js to show/hide buttons (needs to be done like this so don't suggest otherwise) and while <code>btn1</code> is <code>asp:button</code> it always works but for <code>&lt;input type=button&gt;</code> I keep getting this error</p>
  
  <pre><code>Microsoft JScript runtime error: Unable to get value of the property 'style': object is null or undefined
  </code></pre>
  
  <p>The way to fix that for <code>btn1</code> was to just add <code>ClientID=Static</code> but how to do that for <code>&lt;input&gt;</code> button? (I do not want to make it asp:button since I need it to not postback)</p>
  
  <p>Everything is in an UpdatePanel with ClientID=Static also.</p>
  
  <p>I know its something to do with the IDs and the master page since it works fine on a page on its own.</p>