HeadScriptManager

Register your client script so that it is rendered in the <head> of a document rather than in the defalt .NET <form> tag. Typically used in master pages.

// Register included script
HeadScriptManager.Current.RegisterHeadScriptInclude("MyScripts", UrlAide.Resolve("~/js/my-scripts.js"));

// Register script block
HeadScriptManager.Current.RegisterHeadScriptBlock(typeof(Page), "SayHello", "<script type=\"text/javascript\">alert('Hello!');</script>");

Last edited Mar 10, 2007 at 10:55 AM by stebrennan, version 2

Comments

No comments yet.