title: Inject Javascript from asp.net code behind files
body: <p>Am I injecting this correctly?</p>
  
  <pre><code>string myScriptName = "EventScriptBlock";
  string myScript = string.Empty;
  
  //Verify script isn't already registered
  if (!ClientScript.IsClientScriptBlockRegistered(myScriptName))
  {
      Response.Write('b');
      myScript = "\n&lt;script type=\"text/javascript\" language=\"Javascript\" id=\"EventScriptBlock\"&gt;\n";
      myScript += "alert('hi');";
      myScript += "\n\n &lt;/script&gt;";
  
      ClientScript.RegisterClientScriptBlock(this.GetType(), myScriptName, myScript);
  }
  </code></pre>
  
  <p>This is in my <code>Page_Load</code>, but I never see an alert and I have no JavaScript errors either.</p>