title: Not getting ClientID in ASP.Net
body: <p>I have ASP.Net page where i am calling a JavaScript function like this:</p>
  
  <pre><code> Enter server name: &lt;asp:TextBox ID="txt_name" runat="server"&gt;&lt;/asp:TextBox&gt;
   &lt;asp:Button ID="btn_view" runat="server" OnClick="View_btn_click" OnClientClick="return  AlertOnGo('View Configuration',document.getElementById('&lt;%= txt_name.ClientID %&gt;').value)" Text ="GO!" /&gt;
  </code></pre>
  
  <p>But on clicking the GO button, i am getting the following error:</p>
  
  <p><strong>JavaScript runtime error: Unable to get property 'value' of undefined or null reference</strong></p>
  
  <p>On viewing the rendered code for the button:</p>
  
  <pre><code>&lt;input type="submit" name="btn_view" value="GO!" onclick="return AlertOnGo('View Configuration',document.getElementById('&lt;%= txt_name.ClientID %&gt;').value);" id="btn_view" /&gt;
  </code></pre>
  
  <p>It is not putting the appropriate ClientID. I tried setting the CLientIDMode to static for the test box, yet no help.</p>
  
  <p>This question is similar to this <a href="https://stackoverflow.com/questions/7147906/issue-getting-clientid-in-asp-net-c-sharp">unanswered question</a>.</p>