Posted By

housecor on 03/30/11


Tagged


Versions (?)

Add js and css from codebehind


 / Published in: C#
 

  1. HtmlHead head = (HtmlHead)Page.Header;
  2. HtmlLink link = new HtmlLink();
  3. link.Attributes.Add("href", Page.ResolveClientUrl("~/css/your sheet.css"));
  4. link.Attributes.Add("type", "text/css");
  5. link.Attributes.Add("rel", "stylesheet");
  6. head.Controls.Add(link);
  7.  
  8. Page.ClientScript.RegisterClientScriptInclude("jsname", Page.ResolveUrl("~/javascript/yourjs.js"));

Report this snippet  

You need to login to post a comment.