PC Review


Reply
Thread Tools Rate Thread

Best way to modify HTML HEAD from web control

 
 
darrel
Guest
Posts: n/a
 
      5th Aug 2005
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


 
Reply With Quote
 
 
 
 
AndrewF
Guest
Posts: n/a
 
      5th Aug 2005
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

 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      5th Aug 2005
> 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



 
Reply With Quote
 
Bruce Barker
Guest
Posts: n/a
 
      5th Aug 2005
note: RegisterClientSideScript add the script right after the <form>, not
inside the <head>

-- bruce (sqlwork.com)


"AndrewF" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I Use HTML Text Writer i a Custom Control to Render the <head> Section? Frank Microsoft C# .NET 2 18th Jan 2006 08:04 PM
Re: Can I Use HTML Text Writer i a Custom Control to Render the <head> Section? Frank Microsoft C# .NET 0 18th Jan 2006 06:44 PM
Can I Use HTML Text Writer i a Custom Control to Render the <head> Section? Frank Microsoft C# .NET 1 18th Jan 2006 05:42 PM
Still confused...using an HTML Control to modify an HTML tag's value darrel Microsoft ASP .NET 6 15th Oct 2004 08:16 PM
webBrowser control - modify the "head" of a document Boban Dragojlovic Microsoft Dot NET Framework Forms 0 17th Jul 2003 05:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:56 AM.