473,396 Members | 1,853 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.

Best way to modify HTML HEAD from web control

I have a webcontrol for the navigation our site. I'd like to load some
javascript with it. Normally, one would put these in the HEAD of the parent
page. Is there a preferred method for adding tags to the HEAD of a parent
page from a web control?

In the past, I've simply created a 'header tags' control and any time
another controls needs to write something in the head, I add that to this
other control. That doesn't seem to be the best method.

-Darrel
Nov 19 '05 #1
3 1102
Hi mate,

use the Page.RegisterClientSideScript(string ID, string Script) method
and this will take care of it all for you. This way you can specify
your stuff in a different file or wherever and just pass in the string
and off you go.

Cheers
AndrewF

Nov 19 '05 #2
> use the Page.RegisterClientSideScript(string ID, string Script) method
and this will take care of it all for you. This way you can specify
your stuff in a different file or wherever and just pass in the string
and off you go.


Instead of passing the entire script, can one just pass a link to the .js?

In otherwords, I don't need to actually put JS in the HEAD, but just the
SCRIPT tag:

<script type="text/javascript" src="/myscript.js"></script>

-Darrel

Nov 19 '05 #3
note: RegisterClientSideScript add the script right after the <form>, not
inside the <head>

-- bruce (sqlwork.com)
"AndrewF" <an****@transitionkiteboarding.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi mate,

use the Page.RegisterClientSideScript(string ID, string Script) method
and this will take care of it all for you. This way you can specify
your stuff in a different file or wherever and just pass in the string
and off you go.

Cheers
AndrewF

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: user | last post by:
I created a window with var mywindow = window.open( "some/local.html", "mywindow", "width=..., "height=...., ..." ); The window shows up. It contains a table. <table> <tr> <td>begin</td>
4
by: ALESSANDRO Baraldi | last post by:
Good evening. Few day ago i ask about this Object. A very kindly replay of Sthepen Lebans give me the solution to use ClipBoard to synthesise the Conversion, but i've some truble. My scene: ...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
2
by: Michael | last post by:
I don't like to code redundant information on every web page I write. For a particular website, I want to code the following information at the top of the page. <html> <head> <title>My...
2
by: leila | last post by:
I am developing an ASP.Net application for a client and they need to modify the page layout from within a form. like the way you edit a blog template in Blogger. what is the best approach to do...
2
by: Frank | last post by:
From: "Frank" <fkaesser@pfmail.com> Subject: Can I Use HTML Text Writer i a Custom Control to Render the <head> Section? Date: Wednesday, January 18, 2006 11:38 AM I would like to create a...
17
by: 2005 | last post by:
Hi In C++, are the following considered best practices or not? - passing aguments to functions (ie functions do not take any arguments ) - returning values using return statement Anything...
5
by: nasse | last post by:
I am getting the following error msg whenever I try to login. I tried to turn my output_buffering = On in my php.ini but is not working for me. Would you please help me: Warning: Cannot modify...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.