Am I injecting this correctly?
string myScriptName = "EventScriptBlock";
string myScript = string.Empty;
//Verify script isn't already registered
if (!ClientScript.IsClientScriptBlockRegistered(myScriptName))
{
Response.Write('b');
myScript = "
<script type="text/javascript" language="Javascript" id="EventScriptBlock">
";
myScript += "alert('hi');";
myScript += "
</script>";
ClientScript.RegisterClientScriptBlock(this.GetType(), myScriptName, myScript);
}
This is in my Page_Load
, but I never see an alert and I have no JavaScript errors either.