469,097 Members | 1,494 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,097 developers. It's quick & easy.

Javascript between <HEAD> Tags

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
Nov 19 '05 #1
1 1608
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...javascript.asp

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

***************************
Think Outside the Box!
***************************
"MBO" wrote:
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

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by francescomoi | last post: by
15 posts views Thread by Frances | last post: by
10 posts views Thread by Brian W | last post: by
1 post views Thread by MBO | last post: by
5 posts views Thread by Arne | last post: by
2 posts views Thread by =?Utf-8?B?Um9uIEphbWVz?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.