开发者

How to apply customizable skins to an ASP.NET web site?

开发者 https://www.devze.com 2023-02-12 17:49 出处:网络
I\'m writing a SaaS application with a web front end written in ASP.NET.I\'m not much of a designer, and my ASP.NET knowledge is not yet at the expert level - I usually focus on server side stuff - bu

I'm writing a SaaS application with a web front end written in ASP.NET. I'm not much of a designer, and my ASP.NET knowledge is not yet at the expert level - I usually focus on server side stuff - but I have a basic master page and style sheets, which do the trick.

Now I want to offer my customers the ability to customize their web site with their own style sheets, colors, background pictures etc. so that their customers will log onto their portal at mycustomer.mydomain.com and see the skin that "mycustomer" has chosen.

Haven't the faintest clue how to d开发者_StackOverflow社区o this. How?


If you are allowing the customer to specify his own CSS (either as a File or in some textBox in your Page). You can simply save it as a .css file in a virtual directory and During Page_Load or Page_Init Event add it to your page. You need to push a Link tag to Header of the page

Like this:

// Define an HtmlLink control.
HtmlLink myHtmlLink = new HtmlLink();
myHtmlLink.Href = "~/CustomersCustomStyleSheet.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");

// Add the HtmlLink to the Head section of the page.
Page.Header.Controls.Add(myHtmlLink);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号