Hey guys. I don't do HTML or Javascript, I prefer to work in C#, but one of the JS guys tells me that he needs a script included within the head tag. The page in question is a content page of a master page. I can't seem to make this work. I tried adding the script by a programmatic reference this.ClientScript.RegisterClientScriptInclude
, but it came out in the <body>
tag. I tried adding a ScriptManager and a ScriptReference in the contentplaceholder inside the <head>
tag of the master page, but this didn't work either. How can this be accomplished?
Add a comment
|
1 Answer
Just put a client side reference to the script in.
<head> <script lang="Javascript" src="./scripts/yourscript.js"></script>
Or, if it needs to be inline, include the actual script right there in the master page.
-
The purpose of doing it in the content page is so that it doesn't get included in the master page. Surely you can't just go declaring
<head>
twice?– PuppyCommented Mar 19, 2011 at 22:10 -
This was the right answer. Turns out that you can just spew HTML inside the Content tag.– PuppyCommented Mar 19, 2011 at 22:25
-
I misread the question and thought you wanted it in the master page. Sorry about that. I guess you could do it in the master page but with a conditional that it only appeared on this one page.– BenCommented Mar 19, 2011 at 22:25