Include javascript programmatically using ASP.NET 2.0
The thing is I want to include javascript into the page programmatically mainly because I want to use the full url for the source of the javascript.
So I put these on the code behind during the OnLoad event.
int i = 1;
HtmlGenericControl script = new HtmlGenericControl("script");
script.Attributes.Add("type","text/javascript");
script.Attributes.Add("src",Page.ResolveUrl("~/your url"));
//add after the title tag
Page.Header.AddAt(i++,script);
No comments yet.
Leave a comment
Search
Blogroll
My Bluray
My PC
My PC Games
My PC Games Wish List
My Playstation Games
- Crisis Core
- Dead Space
- Final Fantasy X International (Ultimate Hits)
- God of War
- God of War II
- Metal Gear Solid 2: Substance (Konami Palace Selection)
- Metal Gear Solid 4: Guns of the Patriots [Special Edition]
- Shin Onimusha: Dawn of Dreams (PlayStation2 the Best Reprint)
- Star Wars The Force Unleashed


