Master Pages and Style tags

C

cmay

It seems that when you are creating a page that uses a Master Page,
there is no place to put a style block w/o VS.Net saying that you are
putting in an incorrect tag.

Where should a style block go on a page that uses a Master Page?
 
M

Mark Rae

It seems that when you are creating a page that uses a Master Page,
there is no place to put a style block w/o VS.Net saying that you are
putting in an incorrect tag.

That's right, because content pages don't include a header section - that's
in the MasterPage
Where should a style block go on a page that uses a Master Page?

using (Style objStyle = new Style())
{
objStyle.ForeColor = System.Drawing.Color.Red;
objStyle.BackColor = System.Drawing.Color.White;
Header.StyleSheet.CreateStyleRule(objStyle, null, "body");
}

Or, to add an entire stylesheet:

using (HtmlLink objLink = new HtmlLink())
{
objLink.Attributes.Add("type", "text/css");
objLink.Attributes.Add("rel", "stylesheet");
objLink.Attributes.Add("href", "../css/MyOtherStyles.css");
Header.Controls.Add(objLink);
}
 
M

Mark Rae

Have you learned how to control the order of the linked stylesheet written
into the head element when using Themes?

No - maybe one of the "slimy cockroach MVPs" (your words, not mine) might
know...
 
C

cmay

That seems pretty easy for stuff like forecolor and borders, but what
about other CSS stuff like this?

..LH1 {white-space: nowrap;}
BODY {margin:0px}

How would you create a Style object to represent these CSS properties?


Chris
 

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