Home All Groups Group Topic Archive Search About
Author
12 Nov 2006 7:52 PM
David Thielen
Hi;

Is there a way to do most of the formatting for controls in a css file and
then just pass the created styles to the control via the skin? There is a
CssClass property but the documentation sounds like the control makes that
class and it cannot be used to set it to a class we create.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

Author
13 Nov 2006 6:19 AM
Walter Wang [MSFT]
Hi Dave,

Following is some steps of my test to use the CSS from a theme:

1. Create a default web site, add the App_Themes folder, create a new theme
named "Theme1"
2. Create a new stylesheet in theme1 with following content:

.highlight
{
    background-color: Yellow;
}

3. Create a new skin in Theme1 with following content:

<asp:Label CssClass="highlight" runat="server" />

4. In Default.aspx, use this theme:

<%@ Page Theme="theme1" ...

5. Create a new label in it:

<asp:label ID="label1" runat="server" Text="Hello World"></asp:label>

6. View this page in browser, you will notice the background color of the
label is Yellow as the stylesheet applied.

For more information, please refer to following article:

#Themes In ASP.NET 2.0
http://www.odetocode.com/Articles/423.aspx
Themes and CSS files can work together to control the look of your
application. You can add one or more .css files into a theme directory.
ASP.NET will automatically apply all of a theme's style sheets into a page
by injecting a <link> element for each .css into the header of a page. Your
page must have runat="server" in the <head> tag for the automatic style
sheet inclusion. The pages created by the IDE have this setting
automatically.


Let me know if this answers your question.

Sincerely,
Walter Wang (waw***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a 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.
Author
13 Nov 2006 3:04 PM
David Thielen
Works here too. The wording in the documentation is unclear on this but if it
works then it's ok to do.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




Show quoteHide quote
"Walter Wang [MSFT]" wrote:

> Hi Dave,
>
> Following is some steps of my test to use the CSS from a theme:
>
> 1. Create a default web site, add the App_Themes folder, create a new theme
> named "Theme1"
> 2. Create a new stylesheet in theme1 with following content:
>
> .highlight
> {
>     background-color: Yellow;
> }
>
> 3. Create a new skin in Theme1 with following content:
>
> <asp:Label CssClass="highlight" runat="server" />
>
> 4. In Default.aspx, use this theme:
>
> <%@ Page Theme="theme1" ...
>
> 5. Create a new label in it:
>
> <asp:label ID="label1" runat="server" Text="Hello World"></asp:label>
>
> 6. View this page in browser, you will notice the background color of the
> label is Yellow as the stylesheet applied.
>
> For more information, please refer to following article:
>
> #Themes In ASP.NET 2.0
> http://www.odetocode.com/Articles/423.aspx
> Themes and CSS files can work together to control the look of your
> application. You can add one or more .css files into a theme directory.
> ASP.NET will automatically apply all of a theme's style sheets into a page
> by injecting a <link> element for each .css into the header of a page. Your
> page must have runat="server" in the <head> tag for the automatic style
> sheet inclusion. The pages created by the IDE have this setting
> automatically.
>
>
> Let me know if this answers your question.
>
> Sincerely,
> Walter Wang (waw***@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications. If you are using Outlook Express, please make sure you clear the
> check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
> promptly.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a 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.
>
>