Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 28th, 2006, 11:26 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default CodeBehind,Templates and CSS

Hi,

I am using C# and a template to develop my site. I have a CS file with a base class and then another class that inherits from the base class to build the HTML. I also have an ASCX file with the common header information for the site. And last, there are the pages.

In my ASP version I used CSS file to style the site and in some of the pages I use Style blocks to provide the CSS. In the new pages I have STYLE in the ASCX file and in line style for some of the tags in the ASPX files.

Question:

How can I include either the STYLE block or the CSS file? The C# classes emit the HTML tags for the body, header and title so the CSS file for each page can't be included there unless it is an argument to the page constructor. The ASCX file can import the style sheet, but that means having a style sheet, ASCX file and ASPX file for each page.

Thanks for any help



 
Old March 29th, 2006, 02:45 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I dont understand, are you asking if .NET supports something like the <% #INCLUDE %> from old asp?

"The one language all programmers understand is profanity."
 
Old March 29th, 2006, 12:15 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The PageBase class builds the HTML document, including the DOCTYPE,HTML,HEADER,TITLE and BODY tags and their content.

The page inherits from the PageBase and then adds it's own content which starts with the <%@ Page ... %> followed by <%@ Register ..%> which is then followed by <form></form>.

The question is how to include style without applying it to each of the HTML tags within the <form></form> tags? I have a lot a classes that are styled in either an IMPORTED CSS file or in <style></style> section that is the <header></header> section of the current ASP pages, but not present in the ASPX pages because they use inheritance to build the template. ASP.NET understands #INCLUDE, even though it is better replaced by a user control. In either case, there does not appear to be a good place to include the css style sheet in the reusable page header scenerio.

Thanks

 
Old March 29th, 2006, 07:13 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

It might clarify what I am doing to see the base I am using:

http://www.codeproject.com/aspnet/page_templates.asp

I am currently using the SimplePage. I see no where to add CSS file or <style></style> in the ASPX file. I modified the code to use a USER CONTROL for the common stuff and put it in a ascx file. When I run the page, the style block is after the <body> tag and this is not correct. I can solve this problem by emitting the style block in the code-behind file or emitting the style file name include in the code-behind.

What I can't do is provide a style block or style file in the correct place for the balance of the page.

Hope this makes the problem clear,
Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS HELP:! CSS EXPANDIBLE BACKGROUND FOR TITLE phpuser2000 CSS Cascading Style Sheets 2 December 19th, 2007 12:36 AM
Codebehind not working angshujit ASP.NET 1.0 and 1.1 Basics 1 September 21st, 2007 07:32 AM
Rich's new CSS book: Beginning CSS 2nd Edition jminatel BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 0 June 15th, 2007 11:55 AM
JSP Codebehind buddhudev Pro JSP 0 October 1st, 2005 02:33 PM
Ch15 CodeBehind mahir BOOK: Beginning ASP.NET 1.0 2 May 8th, 2004 01:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.