Return to Snippet

Revision: 14157
at May 20, 2009 18:20 by jink


Updated Code
/// <summary>
/// Registers the client script include.
/// </summary>
/// <param name="src">The file name.</param>
void RegisterClientScriptInclude(string src)
{
	System.Web.UI.HtmlControls.HtmlGenericControl si = new System.Web.UI.HtmlControls.HtmlGenericControl();
	si.TagName = "script";
	si.Attributes.Add("type", "text/javascript");
	si.Attributes.Add("src", src);
	this.Page.Header.Controls.Add(si);
	this.Page.Header.Controls.Add(new LiteralControl("\n"));
}

Revision: 14156
at May 20, 2009 18:02 by jink


Initial Code
/// <summary>
/// Registers the client script include.
/// </summary>
/// <param name="src">The file name.</param>
void RegisterClientScriptInclude(string src)
{
	HtmlGenericControl si = new HtmlGenericControl();
	si.TagName = "script";
	si.Attributes.Add("type", "text/javascript");
	si.Attributes.Add("src", src);
	this.Page.Header.Controls.Add(si);
	this.Page.Header.Controls.Add(new LiteralControl("\n"));
}

Initial URL


Initial Description
Call with the path of any javascript you want to load into the HEAD of the ASPX page.

Initial Title
ASP.net: Add a Javascript tag to the HEAD of the page.

Initial Tags
javascript, load, aspnet

Initial Language
C#