473,395 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Master Pages and Style tags

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?

Dec 20 '06 #1
4 1671
"cmay" <cm**@walshgroup.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
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);
}
Dec 20 '06 #2
Have you learned how to control the order of the linked stylesheet written
into the head element when using Themes?

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP http://wikimapia.org/#y=43038073&x=-...8&z=17&l=0&m=h
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
"cmay" <cm**@walshgroup.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
>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);
}

Dec 20 '06 #3
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.comwro te in message
news:uP****************@TK2MSFTNGP04.phx.gbl...
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...
Dec 20 '06 #4
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

Mark Rae wrote:
"cmay" <cm**@walshgroup.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
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);
}
Jan 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: sasquatch | last post by:
Hi, I've a a site with nested master pages and content pages. I tried using a theme with a stylesheet in the app_themes directory referencing it in the web.config file from a pages tag theme...
3
by: Mike Dee | last post by:
I posted this back in November 2005 a couple times but did not get any responses. I'm hoping someone here can please shed some light on this. I'm new to index server and can't get any DocTitle...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
11
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses master pages. I have some pages that must not be cached on the client. In ASP.NET 1.1 I achieved this using metatags: <meta...
7
by: Rolf Welskes | last post by:
Hello, Master-Content in asp.net is very powerful. But: I have the following: One Master-Form. 30 Content-Forms which are the webpages used. Each of this content-forms must have own...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
6
by: Just Me | last post by:
Hi, I have build a header and footer control which I want to add to my master page, so in essence I want the header, a contact placeholder and a footer. This is something I used to do with...
1
by: shapper | last post by:
Hello, I created a Master Page in ASP.NET 3.5 and VS 2008. Why is a ContentPlaceHolder inserted on the document head? <head runat="server"> <title></title> <asp:ContentPlaceHolder...
4
by: Nathan Sokalski | last post by:
I have a content page from which I need to add a style rule to be used by the page. Since content pages only have the content tags, I obviously need to edit the Master page's style using code. I am...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.