开发者

Including client-side scripts in head in ASP.NET

开发者 https://www.devze.com 2023-02-18 17:01 出处:网络
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 maste

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消