Including client-side scripts in head in ASP.NET
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 开发者_StackOverflowcontentplaceholder inside the <head>
tag of the master page, but this didn't work either. How can this be accomplished?
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.
精彩评论