473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1755
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ryan.mclean | last post by:
Hello everyone. Hope ya'll had a nice New Year. Anyway, my question is why won't this work? I must be doing something dumb . . . here is the code: in the body tag, I have this code (just to...
7
by: Ignac Vucko | last post by:
Is writing a document *during* page load safe and supported for all 4th and 5th generation browsers? If not, can you show me a specific example/browser where it causes problems? <html> <head>...
3
by: francescomoi | last post by:
Hi. I'm trying to insert some text between <head> and <body> but I'm not able. I try with: -------- bodyPoint = document.getElementsByTagName('body'); var myLink =...
15
by: Frances | last post by:
<html> <head> <script> function doIt() { var list = document.forms.product; var selItem = list.options.value; ^^^^^^^ </head>
10
by: Brian W | last post by:
Hi All, I have a web user control that, among other things, provides Print this page, and Email this page functionality I have this script that is to execute on the click of the asp:hyperlinks ...
6
by: Ken Varn | last post by:
I want to add my own custom <STYLE> section in the <HEAD> section of my ASP.NET page within a custom control. Can someone tell me how I can have my custom control add tags to the <HEAD> section of...
1
by: MBO | last post by:
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...
5
by: Arne | last post by:
I need literal controls in the <head> section of my page. I need to be able to load dynamic values in the head section. It works fine in ASP.Net 1.1, but Asp.net 2.0 gives a compile error. I need...
2
by: =?Utf-8?B?Um9uIEphbWVz?= | last post by:
How can I add the following element to the <Headsection of every page? <link href="Styles/main.css" type="text/css" rel="stylesheet"> I would like to do this in my Page base class (in the...
3
by: phpmel | last post by:
Hi guys, I have yet another question. I am working with this html form that uses a template. <head> //is greyed out //some greyed out <style >stuff is next <!-- InstanceEndEditable...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.