While attempting to troubleshoot why client code was not being rendered on a page injected by a user control, I stumbled upon this interesting link. It seems that a form tag is required for it to function properly (even though Page.RegisterClientScriptBlock mentions this requirement but ClientScriptManager.RegisterClientScriptBlock, which I am using, does not specify it).
I am currently working with Visual Studio 2005.
Is there a resolution to this issue?
Edit:
Just to clarify, I would like my control to add JavaScript code to the head section of the page without needing to use the
<form runat="server"
I attempted to achieve this by adding:
HtmlGenericControl x = new HtmlGenericControl("script");
x.InnerText = "alert('123');";
Page.Header.Controls.Add(x);
Unfortunately, this approach did not work for me.