CSS and Asp.net 3.5

S

shapper

Hello,

I would like to use something as follows in my web site:

Master.css
@import url("reset.css");
@import url("global.css");
@import url("flash.css");
@import url("structure.css");

MyPage.Aspx
<style type="text/css" media="Screen">
/*\*/@import url("master.css");/**/
</style>

Can I do this using App_Themes, i.e., placing my CSS files in
App_Themes?

And how can I add

<style type="text/css" media="Screen">
/*\*/@import url("master.css");/**/
</style>

To my Page.Aspx head tag at runtime, and in which event should I do
this?

Thanks,

Miguel
 
J

Jason Hedges

You can reference CSS files from themes. You'll just need to include the
relative path to the theme (example: /app_themes/theme1/style.css).

You can add your <style> information to the page header at runtime in the
Page_Load event. Here's an example in C#:

protected void Page_Load(object sender, EventArgs e)
{
HtmlGenericControl style = new HtmlGenericControl("style");
style.Attributes.Add("type", "text/css");
style.Attributes.Add("media", "Screen");
style.InnerText = "@import url(/master.css);";
Page.Header.Controls.Add(style);
}

Jason
 
C

clintonG

I'm sorry I don't remember the exact details but 2.0 Skins and Themes were
and remain FUBAR as to my knowledge nobody has bothered to refine the design
flaws from 2.0 once releasing 3.0 and then 3.5.

So if you put files and folders in App_Theme folder they are going to be
sorted and loaded out of sequence or something to that effect. Hence your
style declarations will override one another. I've seen a goofy work-around
using a naming scheme that forces contents of App_Themes to sort as wanted.

Again, Microsoft keeps releasing buggy software without fixing it leaving it
as trash and in this context it has something to do with sorting so be
advised. Again, as far as I know none of the bugs or design flaws of 2.0
have been repaired or there would be blogs all over the web making note of
it.

But remember, when its from Microsoft? Its a feature.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top