Xpode.com        Click here to Print this article.

Dynamically add javascript in content page

Some time developers need to call the javascript file from code behind or dynamically from content page then you may call javascript file with below given code.

HtmlGenericControl externalJScript = new HtmlGenericControl();
externalJScript.TagName = "script";
externalJScript.Attributes.Add("type", "javascript");
externalJScript.Attributes.Add("src","FolderName/MyJsFile.js");
this.Page.Header.Controls.Add(externalJScript);



http://
http://

Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=119

Click here to go on website