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
ID attribute has to be present, and tag has to be properly closed (not like HTML).
<link id="MyStyleSheet" rel="stylesheet" type="text/css" runat="server" />
Then in your
Page_Load, simply add a "
href" attribute as below:
Sub Page_Load(Sender As Object, E As EventArgs)
If Not (IsPostBack)
Nothing fancy, very simple, but very useful. It also works for meta tags.