473,405 Members | 2,445 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,405 software developers and data experts.

style tag in content page

I am acclimating to ASP.NET 2.0, so excuse me not using the proper
terminology.

When I say a content page, I meant, a page that has a MasterPageFile
tag in the Page directives. So is that a slave page?

I am noticing that on that page, there is no place to put a style
tag. From what I understand what the master page does, it makes sense
since the master page has the header tag which includes all the link
tags for style sheets.

That much I understand.

But I want to be able to experiment with some CSS locally before
pushing this to the master page. But since the page does not like to
see a style tag anywhere on the page, how would you go about doing
this?

Jul 14 '07 #1
2 5242
"David C" <pr********@gmail.comwrote in message
news:11**********************@g37g2000prf.googlegr oups.com...
>I am acclimating to ASP.NET 2.0, so excuse me not using the proper
terminology.
OK.
When I say a content page, I meant, a page that has a MasterPageFile
tag in the Page directives. So is that a slave page?
No, it's a content page.
But I want to be able to experiment with some CSS locally before
pushing this to the master page. But since the page does not like to
see a style tag anywhere on the page, how would you go about doing
this?
You would do that in the code behind your content page, probably in the
Page_Load method.

HtmlLink objLink = new HtmlLink();
objLink.Href = "MyStylesheet.css"
objLink.Attributes.Add("rel", "stylesheet")
objLink.Attributes.Add("type", "text/css")
Header.Controls.Add(objLink);

http://www.google.co.uk/search?sourc...stylesheet+add
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 14 '07 #2
David C wrote:
I am acclimating to ASP.NET 2.0, so excuse me not using the proper
terminology.

When I say a content page, I meant, a page that has a MasterPageFile
tag in the Page directives. So is that a slave page?

I am noticing that on that page, there is no place to put a style
tag. From what I understand what the master page does, it makes sense
since the master page has the header tag which includes all the link
tags for style sheets.

That much I understand.

But I want to be able to experiment with some CSS locally before
pushing this to the master page. But since the page does not like to
see a style tag anywhere on the page, how would you go about doing
this?
You can add styles to the page with the
Page.Header.StyleSheet.CreateStyleRule method.

Example from MSDN Library:

// Create a Style object for the <BODYsection of the Web page.
Style bodyStyle = new Style();

bodyStyle.ForeColor = System.Drawing.Color.Blue;
bodyStyle.BackColor = System.Drawing.Color.LightGray;

// Add the style to the header of the current page.
Page.Header.StyleSheet.CreateStyleRule(bodyStyle, this, "BODY");

--
Göran Andersson
_____
http://www.guffa.com
Jul 14 '07 #3

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

Similar topics

1
by: Scanner2001 | last post by:
I am trying to insert a printer page break inside of a form. I do not seem to be able to do this. My form contains 3 asp panels. Each of the panels have dynamically built content, and they are...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
2
by: Kenneth P | last post by:
Hi, I'm developing asp.net (vb) apps in VS.NET 2003, and I'd like to know how you can write style sheet code in a sub in an .aspx page that when it's rendered as html/text/css code in the .aspx...
3
by: Paul | last post by:
I found a great site for CSS tempaltes, http://blog.html.it/layoutgala/ . I downloaded them, and played around with them. Then I tried to use the template in as ASP.Net MasterPage, but everything...
2
by: ad | last post by:
I use vs2005 to develop web application. I have used the new feature of master page of VS2005, and I have put some <stylein the master page. But I want to override some Style sheet in the content...
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...
8
by: Amit | last post by:
I have a master page and a content page but the stylesheet isnt getting applied like how it looks in visual studio design view. The master page is defined like this: <%@ Master Language="VB"...
1
by: abaybas | last post by:
I'm creating a page in which a certain "content" part of the page is refreshed using ajax. I do this by using a div#content, and it's child div#container. the code: ... ...
5
by: Nathan Sokalski | last post by:
I have css that would normally be placed in style tags in the header of the Master page that I want to add programmatically for a specific Web Content Form (the *.aspx page). How do I do this for a...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.