Javascript between <HEAD> Tags

M

MBO

Hello NG,

I'm writing a control that needs to put a clientside javascript between the
<HEAD> Tags of a webpage where it is placed on. I've seen from other threads
in this NG, that one solution is to assign a runat="server" and an
id="myheader" attribute to the HEAD-Tag. On the code behind I've defined a
variable Protected myHeader As System.Web.UI.HtmlControls.HtmlGenericControl
to access the HEAD tag.

My Problem is, that everytime when I change between design and HTML view,
visual studio is removing the runat="server attribute". Has anyone an idea
why this is happening?

Thanks and Regards

MBO
 
G

Guest

As long as you have a container, you can attach a literalControl to that
container. I have not tried with the <HEAD> portion, but that would be one
method of doing it.

If it does not absolutely have to be in the <HEAD> portion to run, you have
the ability to use the registration methods of the page class.

http://msdn.microsoft.com/library/en-us/dnaspp/html/aspnet-usingjavascript.asp

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top