Loading CSS Dynamically in a page [Resolved]

Posted by Naresh2k3406 under ASP.NET on 3/19/2012 | Points: 10 | Views : 2734 | Status : [Member] | Replies : 2
Can we load CSS files dynamically in a aspx page?




Responses

Posted by: Sksamantaray on: 3/19/2012 [Member] Silver | Points: 50

Up
0
Down

Resolved
Hi Naresh,
use this,

                HtmlLink link = new HtmlLink();

link.Href = "~/css/" + Session["Theme"].ToString().Trim() + ".css";
link.Attributes["rel"] = "stylesheet";
link.Attributes["type"] = "text/css";
Page.Header.Controls.Add(link);

Mark as answer , if works

Thanks,
Sanjay

Naresh2k3406, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naresh2k3406 on: 3/19/2012 [Member] Starter | Points: 25

Up
0
Down
It worked. Thanks Sanjay.

Naresh2k3406, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response