Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




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);

Share this article   |    Print    |    Article read by 1710 times
Author:
Rohit kakria
I am software developer, moderator of xpode.com
Related Articles:
Related Interview Questions: