Saturday, March 31, 2012

Themes, Skins, and Masters

Hi. I am having trouble grasping the concept of applying a consistent
theme to an ASP.net website. I didn't used to like ASP because it was
too hard to apply a theme from a common theme folder like I could do
easily in PHP, but now I see that it has some nicer theming features
and master files.
So I want to use web.config to switch which theme I'm using, and I
want to be able to have several themes. My understanding of themes is
that I can only define styling in them as I could with CSS, but I
can't define code for the header, footer, etc with them. And that's
where master files come in, right? I'd like to switch which set of
master files is in use as the theme changes. IE, I'd like to put
several master pages that match in looks but have different functions
in each theme's folder along with the skins. But I don't think that it
will automatically switch to those masters when the theme is switched
in web.config. Can I use a variable in the <%@dotnet.itags.org. Page
MasterPageFile="... part? Specifically, can I include Page.Theme into
the middle of a path, like:
<%@dotnet.itags.org. Page MasterPageFile="App_Themes/{Page.Theme}/m1.master" %>
I can't make the themes very varied if all I can edit is the skins and
they all have the same xHTML code.
Also, what is the difference between global themes in the /Themes/
directory and page themes in the /App_Themes/ directory?
So is this possible? Or am I thinking along the wrong lines to do such
a thing?
-Mike PIIBriefly, we use the Page_PreInit event handler to change Themes and
MasterPages noting K. Scott Allen has documented the most helpful
information regarding this topic at http://odetocode.com/ but if you want to
master ASP.NET you need to delve into the page life cycle and learn it well
as it is fundamental to this and related tasks.
When using MasterPages you will also need to learn how to reference controls
which can be and is somewhat convoluted when using the FindControl method.
Try to get the hang of writing public properties to avoid using FindControl
when possible.
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
<mike@.learntoprogram.info> wrote in message
news:1178930483.643472.134670@.h2g2000hsg.googlegroups.com...
> Hi. I am having trouble grasping the concept of applying a consistent
> theme to an ASP.net website. I didn't used to like ASP because it was
> too hard to apply a theme from a common theme folder like I could do
> easily in PHP, but now I see that it has some nicer theming features
> and master files.
> So I want to use web.config to switch which theme I'm using, and I
> want to be able to have several themes. My understanding of themes is
> that I can only define styling in them as I could with CSS, but I
> can't define code for the header, footer, etc with them. And that's
> where master files come in, right? I'd like to switch which set of
> master files is in use as the theme changes. IE, I'd like to put
> several master pages that match in looks but have different functions
> in each theme's folder along with the skins. But I don't think that it
> will automatically switch to those masters when the theme is switched
> in web.config. Can I use a variable in the <%@. Page
> MasterPageFile="... part? Specifically, can I include Page.Theme into
> the middle of a path, like:
> <%@. Page MasterPageFile="App_Themes/{Page.Theme}/m1.master" %>
> I can't make the themes very varied if all I can edit is the skins and
> they all have the same xHTML code.
> Also, what is the difference between global themes in the /Themes/
> directory and page themes in the /App_Themes/ directory?
> So is this possible? Or am I thinking along the wrong lines to do such
> a thing?
> -Mike PII
>
On May 12, 5:00 pm, "clintonG" <nob...@.nowhere.com> wrote:
> Briefly, we use the Page_PreInit event handler to change Themes and
> MasterPages noting K. Scott Allen has documented the most helpful
> information regarding this topic athttp://odetocode.com/but if you want to
> master ASP.NET you need to delve into the page life cycle and learn it wel
l
> as it is fundamental to this and related tasks.
> When using MasterPages you will also need to learn how to reference contro
ls
> which can be and is somewhat convoluted when using the FindControl method.
> Try to get the hang of writing public properties to avoid using FindContro
l
> when possible.
> <%= Clinton Gallagher
> NET csgallagher AT metromilwaukee.com
> URLhttp://clintongallagher.metromilwaukee.com/
Thanks for your help. I finally got it down.
ASP.net is .
-Mike PII

0 comments:

Post a Comment