.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Link CSS at Runtime

Posted By:Sasi Prabhu       Posted Date: July 06, 2011    Points: 40    Category: Javascript    URL: http://www.dotnetspark.com  

This article is used to make link at runtime.

To Make Link CSS File in Programmatically.

Protected void Page_PreInit(object sender,EventArgs e)

System.Web.UI.HtmlControls.HtmlLink cssFile=new System.Web.UI.HtmlControls.HtmlLink(); cssFile.href="CSS/StyleSheet.css"; cssFile.Attributes["rel"]="stylesheet"; cssFile.Attributes["type"]="text/css"; Page.Header.Controls.Add(css);


System.Web.UI.HtmlControls.HtmlLink - Used to Create a Links in an HTML Documents.

href - CSS File Path.

Attributes - Used add the Some attributes to HtmlLink Control.

Page.Header.Controls.Add() - Adding Controls into the Header of the Page.


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend