Is there a System.Web.UI.ClientScriptManager method that registers scripts inside the <head> tag?
问题 I know it's strictly OK to put <script> tags in the body, but in the interest of neatness I'd like to use System.Web.UI.ClientScriptManager to register a script in the <head> of my page. Is there a method to accomplish this? Thanks in advance. 回答1: In these cases I usually add a ContentPlaceHolder in the tag of my Master Page. Alternately I've used a method (usually in a utility class or PageBase class) that puts the script string in a List and stores it in the ASP.Net Context like so: List