0

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?

1 Answer 1

1

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.

3
  • 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?
    – Puppy
    Commented Mar 19, 2011 at 22:10
  • This was the right answer. Turns out that you can just spew HTML inside the Content tag.
    – Puppy
    Commented 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.
    – Ben
    Commented Mar 19, 2011 at 22:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.