I am loading a css in my master page ...
<link rel="stylesheet" href="css/mystyles.css" title="styles" type="text/css" />
Now I want to load this dynamically according to a web.config key. Is there a better/ standard way of doing this, or is my idea the standard way?
Thanks
Option 1:
You can add runat="server" attribute in your css link and set href value from code behind file where you can dynamically set it.
Option 2:
HtmlLink link = new HtmlLink();
link.Attributes["href"] = filename;
link.Attributes["type"] = "text/css";
link.Attributes["rel"] = "stylesheet";
Page.Header.Controls.Add(link);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With