aspx Tutorial

NET Articles,jQuery demo, with jQuery, online tutorial,Jquery, SilverLight, Javascript,,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here


Get our toolbar!


Posted by Aamir Hasan   on Monday, November 1, 2010 Total Views:  

In this article I have told you that how to append javascript link under the head section. HTMLGenericControl is server control which provide html control tags which are <body>, <head>, <div>,<p>,<li> elements etc.

Here's is the solution

    protected void Page_Load(object sender, EventArgs e)


        HtmlGenericControl JSFile = new HtmlGenericControl();

        JSFile.TagName = "script";

        JSFile.Attributes.Add("type", "text/javascript");

        JSFile.Attributes.Add("language", "javascript");

        JSFile.Attributes.Add("src", ResolveUrl("Scripts/script.js"));



Note: Add “System.Web.UI.HtmlControls” namespace to load HtmlGenericControl class


Download (137.85 kb)

See live demo

Protected by Copyscape Online Plagiarism Tool

Add comment

  Country flag

  • Comment
  • Preview

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5