|
| |
|
|
Avick
Posts: 181 From: Ireland Status: offline
|
Head Data in linked master/Content Page - 12/2/2007 11:39:04
I’m having a bit of a problem with the head section of a Master page and a Content Page. I am trying to add different CSS Page and some head tags to each content page linked to a master page. I have searched the web and found a little information on the topic but no one makes it clear where the code should go and how it should be formatted. If I can achieve this then I would be able to add Keywords and Descriptions to each page along with a different style sheet. I can put the page title in, no problem, but I would like to access more then this on each page. Anyone any Ideas.
_____________________________
Alan http://www.newebirl.net
|
|
|
|
Tailslide
Posts: 6003 Joined: 5/10/2005 From: Out here on the raggedy edge Status: offline
|
RE: Head Data in linked master/Content Page - 12/2/2007 14:52:44
Why would you want a different stylesheet on different pages? Much too much like hard work - best to keep them to a minimum (maybe a normal one, a PDA one and a print one plus maybe an IE one if necessary). You could give each page an id in it's body element and then specify different rules in the normal stylesheet according to that body id - so effectively giving a page a whole different look if required. Are you talking about a template or something like that - as you can easily add different content to your head area in a normal static site. If you use PHP you can also specify content according to which page you're on (you give each page an id and then add a script saying something like - if this is "home" then do this, otherwise do that).
_____________________________
"My strategy is so simple an idiot could have devised it" Little Blue Plane Web Design | Blood, Sweat & Rust - A Land Rover restoration project
|
|
|
|
Avick
Posts: 181 From: Ireland Status: offline
|
RE: Head Data in linked master/Content Page - 12/2/2007 17:20:29
Hi Tailslide I am planning to have a separate Style Sheet for each section of the site so I can change the color of each section. I create one master Style Sheet then using the @import item I can create different style sheets with just a very few lines of code. As for the other items. I want to put a different list of Meta tags on each page such as creation date, descriptions and so on. I have left PHP behind as most if not all my work involves ASPX, MS SQL and Access. I believe it can be done, I just don’t know how!! I don’t really want to go back to Creating a template and generating my pages from that as the master page is so much better.
_____________________________
Alan http://www.newebirl.net
|
|
|
|
rdouglass
Posts: 9206 From: Biddeford, ME USA Status: offline
|
RE: Head Data in linked master/Content Page - 12/12/2007 15:20:45
Does my answer to this post help you here at all? http://www.frontpagewebmaster.com/m-378831/tm.htm Except what you'd add is something like this for your CSS: Dim cssLink As New HtmlLink() cssLink.Href = "styles.css" cssLink.Attributes.Add("rel", "Stylesheet") cssLink.Attributes.Add("type", "text/css") Me.Header.Controls.Add(cssLink) Hope it helps.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Avick
Posts: 181 From: Ireland Status: offline
|
RE: Head Data in linked master/Content Page - 12/13/2007 6:29:21
Hi Rdouglass That is what I am looking for. Where do I put this code and in what tags. Can you give me an example??
_____________________________
Alan http://www.newebirl.net
|
|
|
|
rdouglass
Posts: 9206 From: Biddeford, ME USA Status: offline
|
RE: Head Data in linked master/Content Page - 12/13/2007 8:37:22
Did you see my reference to the other post? That has a VB.NET example there for a code-behind page. It would look somethinkg like this: Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Partial Class MyPageClass
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim cssLink As New HtmlLink()
cssLink.Href = "styles.css"
cssLink.Attributes.Add("rel", "Stylesheet")
cssLink.Attributes.Add("type", "text/css")
Me.Header.Controls.Add(cssLink)
End Sub
End Class
You don't put this in any tags but rather this creates the tags and code for a reference to your CSS. This would be on the code-behind page. If your page was named myPage.aspx, the code-behind page would be myPage.aspx.vb and you'd put that code in there. Hope it helps.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Avick
Posts: 181 From: Ireland Status: offline
|
RE: Head Data in linked master/Content Page - 12/13/2007 9:36:17
I have read your other post and I just don't get it. Call me tick but it makes no sense. I give up. Its not for me. No matter what I do I can't get it to work. I have read as much as I can about it and still can't get it right. Its just far to much effort for to little reward.
_____________________________
Alan http://www.newebirl.net
|
|
|
|
Avick
Posts: 181 From: Ireland Status: offline
|
RE: Head Data in linked master/Content Page - 12/14/2007 4:39:21
OK , I have downloaded the file and I will give it another go. Fingers crossed that little spark lights in my brain :)
_____________________________
Alan http://www.newebirl.net
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|