Add scripts to head dynamically - Web Dev And Stuff
Friday, August 8, 2008 11:14 AM djsolid

Add scripts to head dynamically

Many times when i develop a user control i have the need to add some javascript to the header of the page. But the header doesn't have a method where you can add script and RegisterStartupScript inserts the script at the bottom of the page.

So i thought let's create an extension method...

This is how this method can be used for inserting javascript tags to a page's header...

Without the script tags....

And not only javascript but custom css files, meta tags etc...

That's it! Javascript, css files, meta tags and anything else can be inserted to the header dynamically!!

Enjoy...

 

kick it on DotNetKicks.com Filed under: , , , , ,

Comments

No Comments