Re: calling style sheets
- From: "jrl" <jrl@xxxxxxxxxxxxxxxx>
- Date: Mon, 10 Mar 2008 06:40:43 GMT
Ok... As they say 'back to the drawing board' !
My original goal was to create media sets in one big css file, but for some reason the length of the css file created problems with a css validation tool. Therefore, I tried to break the css file into separate media files. Thats when it was suggested that I could stop using the enabletheming approach, and begin using an alternate approach, where I call the css file explicitly, as in <link rel="Style***" type="text/css" media="screen" href="~/App_Themes/rosy/screen.css" />
Do you think that approach could work, to allow me to call three css files, in the master page? and deal with the error "The class or CssClass value is not defined" that results when I use this linking format?
If not, can you suggest any method that would allow allow me to call 3 css files into the master page?
""Steven Cheng"" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message news:WRGgNdngIHA.1500@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Jrl,
The behavior you got is correct. Though you can only specify which Theme to
use at content page level(and only one theme for each page), you can set
"EnableTheming" at multiple level(give you different granularity of control
on Theme). You can set EnableTheming on content page, or on Master Page
or even on ascx usercontrol.
Actually, you can consider Master page as a particular usercontrol.
Therefore, you need to set "EnableTheming = true" on master page so as to
make the Theme/style on it work.
Best regards,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we
can improve the support we provide to you. Please feel free to let my
manager know what you think of
the level of service provided. You can send feedback directly to my manager
at: msdnmg@xxxxxxxxxxxxxx
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------X-Trace-PostClient-IP: 70.67.40.71
From: "jrl" <jrl@xxxxxxxxxxxxxxxx>
In-Reply-To: <jRLemzmgIHA.4672@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: calling style sheets
EnableTheming="true"
Great! I'm sure we're getting closer now.
I have the code behind of the masterpage (masterpage.master.cs) with the
following:
public partial class site : System.Web.UI.MasterPage
{
protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "rosy";
}
}
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
// content removed here, just wanted to show the structure of
keeping the page_load and Page_PreInit separate.
}
}
In the masterpage.master I use the form
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage"
%>"Theme"
I also tried removing EnableTheming="true".
However, although it compiles fine, this setup results in a page which has
no style *** applied.
""Steven Cheng"" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:jRLemzmgIHA.4672@xxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for your quick reply Jrl,
This is my fault here. I should have pointed out the problem that Master
page does not support "Theme" property, therefore, you can not add
gettingattribute in <%@ Master %> directive.
For declarative Theme setting ,you need to set the "Theme" attribute in
content page. Or you can consider programmatically set Theme for a
page(in
master page). e.g.
================
public partial class site : System.Web.UI.MasterPage
{
protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "my theme";
}
...............
==============
#Note: you can only programmatically set Theme in PreInit event since
that's the earliest event you can get to do this.
Best regards,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we
can improve the support we provide to you. Please feel free to let my
manager know what you think of
the level of service provided. You can send feedback directly to my
manager
at: msdnmg@xxxxxxxxxxxxxx
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
X-Trace-PostClient-IP: 70.67.40.71
From: "jrl" <jrl@xxxxxxxxxxxxxxxx>
Newsgroups: microsoft.public.vsnet.general
In-Reply-To: <zo1Bj.65287$w94.58704@pd7urf2no>
Subject: Re: calling style sheets
Further, the error when I compile is
Error 4 Error parsing attribute 'theme': Type 'System.Web.UI.MasterPage'
does not have a public property named 'theme'.
"jrl" <jrl@xxxxxxxxxxxxxxxx> wrote in message
news:zo1Bj.65287$w94.58704@xxxxxxxxxxxx
Ok, I have read the articles you recommended, thanks. I am stillpage."needthe error
"Theme is not valid on a master page. However, the visual
designer accepts this attribute while you are editing the master page."
The syntax I am using is
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage"
EnableTheming="true" Theme="rosy" %>
"rosy" refers to a folder under App_Themes, containing 3 css files.
Am I doing something wrong still?
""Steven Cheng"" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:Mq%23lbClgIHA.4672@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Jrl,
Thanks for your reply.
It seems there is some misunderstanding here.
In the page's "Theme" attribute, you should assign the name of the
Theme(rather than path). Therefore, for your case, you've put a theme
named
"rosy" under App_Themes folder (/App_Themes/rosy), you should use the
following syntax to reference this theme in page:
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage"
EnableTheming="true"
Theme="rosy" %>
Also, for stylesheets, as I mentioned in previous thread, you do notthemeto explicitly reference the style*** in page, you just need to put
those
stylesheets(you want to use in page) under the Theme folder (the
/App_Themes/rosy/.. in your case here). When you applied the "rosy"
andto page, it will automatically link those stylesheets in page's html
output(you can verify it in your client browser's viewsource).
Also, I suggest you read some articles or reference about using Theme
in
ASP.NET, that'll help you understand how it works better.
Best regards,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your commentsitsuggestions about how we
can improve the support we provide to you. Please feel free to let my
manager know what you think of
the level of service provided. You can send feedback directly to my
manager
at: msdnmg@xxxxxxxxxxxxxx
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------Newsgroups: microsoft.public.vsnet.general<op3Aj.53393$w94.4716@pd7urf2no>
References: <d53Aj.53475$pM4.21522@pd7urf1no>
<dvT#icCgIHA.6844@xxxxxxxxxxxxxxxxxxxxxx>
In-Reply-To: <dvT#icCgIHA.6844@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: calling style sheets
I tried using the named theme as you suggest, but got an error becauseisfor a master page.
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage"
EnableTheming="true"
Theme="~/App_Themes/rosy/screen.css" %>
Error: "Attribute Theme is not valid on a master page. However, the
visual
designer accepts this attribute while you are editing the master
includescreen,the
But this might be an unrelated issue, since what I'm trying to do is
use
alternate method of loading style***
for example: <link rel="Style***" type="text/css" media="screen"
href="~/App_Themes/rosy/screen.css" />
And I want to load three stylesheets (one for each type of media:print, and handheld).
How can I load multiple stylesheets with this alternate method?
""Steven Cheng"" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:dvT%23icCgIHA.6844@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi jrl,
From your description, you're using ASP.NET Theme feature andname.yousomecss style sheets in Theme (which will be applied on page), however,Theme="Theme1"found the css class can not be resolved on page, correct?
According to the App_Themes folder and style*** path (also the
<link
...>
tag syntax), I found the following problems:
** For ASP.NET theme, you need to assigne a certain Theme value for
page
in
addition to enabling Theme, e.g.
<%@ Page Language="C#" ............ EnableTheming="true"%>
** You can add multiple Themes into App_Themes folder and each theme
has
all its content(skins or stylesheets) in the subfolder of theircommentsTheme.e.g.
/App_Themes/
/Theme1
stuffs for Theme1
/Theme2
stuffs for Theme2
** For css stylesheets, if you want a certain Theme include some css
styles, just put the css style*** file into the folder of thatAnd
at runtime the page will automatically reference those css
stylesheets(as
long as you've applied the theme on that page):
here are some further articles about using Theme in ASP.NET:
#ASP.NET Themes and Skins Overview
http://msdn2.microsoft.com/en-us/library/ykzx33wh.aspx
#Themes In ASP.NET 2.0
http://www.odetocode.com/Articles/423.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome yourmyand
suggestions about how we
can improve the support we provide to you. Please feel free to lethttp://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifmanager know what you think of
the level of service provided. You can send feedback directly to my
manager
at: msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
reachissuesications.
Note: The MSDN Managed Newsgroup support offering is for non-urgentfollowwhere an initial response
from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
up response may take
approximately 2 business days as the support
professional working with you may need further investigation to
complexthe
most efficient resolution.
The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or
withproject analysis and dump
analysis issues. Issues of this nature are best handled workingCssClassa
dedicated Microsoft Support
Engineer by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------X-Trace-PostClient-IP: 70.67.40.71
From: "jrl" <jrl@xxxxxxxxxxxxxxxx>
Newsgroups: microsoft.public.vsnet.general
Subject: Re: calling style sheets
Sorry, I didn't make it clearer that the error "The class oravalueis not defined" comes up like a tool tip when I hover over theproperty
CssClass,
like over pageheader in the following code:
<div class = "pageheader" >
where pageheader is defined in the css style*** as
.pageheader
{
background-color: #F3F194;
color: #5A5AA5;
}
Also, I notice that when I used the enabletheming, I could set theof a control, in the properties panel, and select the cssclass fromstyledropdown. Now that I use the linked style***, I don't get anyitenablethemingoptions in the properties panel for any control.
So how can I use the linked reference to the style*** (<link
rel="Style***" ...>), and still get the utility I had with
(<%@ Master EnableTheming="true" ....>)?
"jrl" <jrl@xxxxxxxxxxxxxxxx> wrote in message
news:d53Aj.53475$pM4.21522@xxxxxxxxxxxx
At first I learned to call a style *** by the command
EnableTheming, as in
<%@ Master EnableTheming="true" Language="C#"
AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
Using this form to call the style *** in the App_Themes folder
worked
fine.
But then I needed to break my style*** into smaller chunks, soimplementswas
recommended that I use the following form within the head section.
<link rel="Style***" type="text/css" media="screen"
href="~/App_Themes/screen.css"
Now I notice the references to styles, are generating an
interpreter
warning "The class or CssClass value is not defined" when I view
the
source code, even though it does load the linked style*** and
somethingthe styles when it generates the webpage.
Is this normal? (that it would warn this error) or am I missingin order to use this function?
.
- Follow-Ups:
- Re: calling style sheets
- From: "Steven Cheng"
- Re: calling style sheets
- References:
- calling style sheets
- From: jrl
- Re: calling style sheets
- From: jrl
- Re: calling style sheets
- From: "Steven Cheng"
- Re: calling style sheets
- From: jrl
- Re: calling style sheets
- From: "Steven Cheng"
- Re: calling style sheets
- From: jrl
- Re: calling style sheets
- From: jrl
- Re: calling style sheets
- From: "Steven Cheng"
- Re: calling style sheets
- From: jrl
- Re: calling style sheets
- From: "Steven Cheng"
- calling style sheets
- Prev by Date: Re: can I define custom colors?
- Next by Date: RE: MailMessageEvent is inaccessible
- Previous by thread: Re: calling style sheets
- Next by thread: Re: calling style sheets
- Index(es):
Loading