Introduction
I had a tough time finding this online so I thought I would post it on CodeProject.com.
I wanted to be able to dynamically set a link to a CSS file. For example, for users to be able to personalize their site, change the look and feel.
Just add a runat
attribute to your traditional link
tag. ID
attribute has to be present, and tag has to be properly closed (not like HTML).
<head>
<link id="MyStyleSheet" rel="stylesheet" type="text/css" runat="server" />
</head>
Then in your Page_Load
, simply add a "href
" attribute as below:
Sub Page_Load(Sender As Object, E As EventArgs)
If Not (IsPostBack)
MyStyleSheet.Attributes.Add("href","/css/flostyle.css")
End If
End Sub
Nothing fancy, very simple, but very useful. It also works for meta tags.
Broad engineering background with business knowledge (graduated from a top French engineering school training entrepreneurs), and excellent relationship skills that Flo utilizes in the I.T. field to streamline/improve company processes.
From web to embedded programming, from a big-5 consulting company to a local hospital, Flo shares his time between development and implementation lead.
Work with ASP.NET, VB.NET, LDAP, SQL Server, Oracle, MySQL...