
Signature
Alan Silver
(anything added below this line is nothing to do with me)
>>Only, I haven't made any reference to any specific .css file--meaning,
>>apparently, that any aspx file that simply references a theme will use any
[quoted text clipped - 3 lines]
>
> "Correct" meaning that this is sensible, then no.
While I'm learning to appreciate some .NET things, I'm quickly finding that
there's a lot of things I wouldn't have designed the way they are. Well,
that's just MS being MS, I guess...been there, done that.
>> Can I control that? I'd like to keep organizing things in separate .css
>> files, but don't necessarily want them *all* automatically included in
>> aspx pages that don't need them.
>
> One of my long-time gripes with themes. I have tried to find a solution to
> this and failed.
Hearing this sort of thing isn't particularly encouraging, especially when
this is one of the very first things ever I've tried doing in .NET beyond a
Hello, World page...I've been holding off on learning .NET for a very long
time (I've skipped 1.0 and 1.1 entirely), and now that I'm knee-deep into
it, the reality is such a huge contrast to the endless praise I've been
hearing for years...
Anyway...I don't know if this can be useful to you, coming from a noob such
as myself...I ended up implementing some suggestion I've stumbled upon in
some other forums. For now, I'm willing to forget all about themes.
Essentially, I put a reference to my "base" CSS file in my master page's
<head> as one normally would:
<link href="site.css" rel="stylesheet" type="text/css" />
...followed by an 'empty' one:
<link href="" id="idExtraStyleSheet" rel="stylesheet" type="text/css"
runat="server" />
...then for any page requiring an additional CSS file, I use the following
in its Page_Load() event:
MasterPage m = (MasterPage)Page.Master;
m.ExtraStyleSheetURL = "~/SomePath/UrlToMyAdditionalCssFile.css";
Of course it means I have a bogus "goes-nowhere" <link href=""> tag if I
have a page that *doesn't* need an additional CSS, but that's not causing
any problem.
I'll try to figure out the equivalent "MS-way" later. I'm not holding my
breath though since there doesn't appear to be a short answer to this one.
>>From what I've been seeing, there's an awful lot of books that introduce
>>various ASP.NET topics, but very few present things in a "this is how you
[quoted text clipped - 4 lines]
> classic ASP and reading Asp.NET books as though it was something entirely
> new.
While I don't necessarily disagree, the intent behind that observation was
just to suggest that I'm convinced there's a market for it. How many
long-time classic ASP coders have moved on to ASP.NET and would buy a book
to assist with the transition, as opposed to the endless supply of help-file
type of books?
> Read these forums for a bit and see how many people struggle with the
> changeover. Most of them suffer from trying to make ASP.NET work in the
> classic ASP way. It's far better to make a clean break and treat it as a
> new subject entirely.
It's really a matter of using the right tool for the right job... On one
hand, if something is doable in ASP.NET but is completely awkward, then
that's an indication that I (as a .NET newbie) don't fully understand the
how and the why. On the other, I'd rather stick with the tried-and-true
methods where it makes sense, and not do absolutely everything "the .NET
way" just because this is what MS suggests.
For one--and it's still early in my learning process--I find that ASP.NET
generates *way* more inline styles (as tag attributes) than I would ever
hand-code, especially when "the old method" can be rewritten in a much
cleaner CSS file in a line or two. I find having some server control
attributes in an aspx file, along with separate CSS files, really confuses
matters. And then, of course, not all attributes you can put in a CSS file
can be specified as server control attributes either, so I really have no
choice but to have some styles specified in one location, and others
specified elsewhere...I feel I'm stepping backwards.
>>Finding the exact keywords on Google to find relevant results for this
>>sort of thing also seem to escape me...
>
> Yeah, that can be a problem too. That's where these groups are so good!
Yeah, but my gripe is that it's often quicker to find a relevant answer and
get right back to work than posting a new message and waiting for a
response. No offense to anyone here--I'm a long-time Usenet user...it's
just the nature of things...
Alan Silver - 20 Jul 2007 09:19 GMT
<snip>
>>> Can I control that? I'd like to keep organizing things in separate .css
>>> files, but don't necessarily want them *all* automatically included in
[quoted text clipped - 9 lines]
>it, the reality is such a huge contrast to the endless praise I've been
>hearing for years...
Maybe I should qualify the comment by saying that having done ASP.NET
for a couple of years now, it is *way* better than classic ASP. Once you
get into the swing of it, you wonder how you ever did classic at all. I
look back at old sites and cringe at how badly they were implemented.
That's partly my fault and partly MS's. ASP.NET does encourage you to
make a complete separation between code and output (ie the (X)HTML), and
that's a very powerful and positive step forwards.
I could list grips I had with classic ASP was well. You just happen to
have hit one I have with ASP.NET. Themes are still a great idea, they
just need some improvement. Even as they are, they are a load better
than doing the same idea yourself.
>Anyway...I don't know if this can be useful to you, coming from a noob such
>as myself...I ended up implementing some suggestion I've stumbled upon in
>some other forums. For now, I'm willing to forget all about themes.
>Essentially, I put a reference to my "base" CSS file in my master page's
><head> as one normally would:
<snip>
Thanks for the idea. It's worth considering. You would need some central
mechanism for controlling which page got which CSS file though,
otherwise you would end up with a real mess.
>>>From what I've been seeing, there's an awful lot of books that introduce
>>>various ASP.NET topics, but very few present things in a "this is how you
[quoted text clipped - 10 lines]
>to assist with the transition, as opposed to the endless supply of help-file
>type of books?
Dunno. I tried adapting my classic ASP way of thinking, then realised
that it was confusing rather than helping. I bought ASP.NET Unleashed by
Steven Walther and treated myself as a beginner. It was one of the best
books of it's type I ever read and got me going fast. I still use it
sometimes.
>> Read these forums for a bit and see how many people struggle with the
>> changeover. Most of them suffer from trying to make ASP.NET work in the
[quoted text clipped - 7 lines]
>methods where it makes sense, and not do absolutely everything "the .NET
>way" just because this is what MS suggests.
Trouble is, the "tried and true" method for classic ASP is often
completely the wrong method for ASP.NET and vice-versa. That's why I
suggested approaching ASP.NET as a newbie, it avoids the problem of
thinking you know the best way to do something, when really the way you
have in mind might be completely inappropriate for ASP.NET. It really is
a new (but highly (superior) way of thinking.
>For one--and it's still early in my learning process--I find that ASP.NET
>generates *way* more inline styles (as tag attributes) than I would ever
[quoted text clipped - 5 lines]
>choice but to have some styles specified in one location, and others
>specified elsewhere...I feel I'm stepping backwards.
Hmm, sounds more like a structure issue than a problem with the way
ASP.NET handles it. I'd need to see a more concrete example before I
could say though.
I do agree about some of the markup produced by the framework. I quickly
learned never to use the Label control as it creates extra markup you
just don't need. My code tends to have things like...
<h2><asp:Label ID="fred" runat="server" /></h2>
...so I can just set the value of the literal, and know that the markup
will be clean.
I do all of my presentation with CSS, so the .aspx file tends to be very
vanilla (X)HTML and nothing more. That keeps the separation between
content and presentation very well, making better structured pages and a
much easier implementation of themes.
>>>Finding the exact keywords on Google to find relevant results for this
>>>sort of thing also seem to escape me...
[quoted text clipped - 5 lines]
>response. No offense to anyone here--I'm a long-time Usenet user...it's
>just the nature of things...
Yup, you need to do both.
Ta ra

Signature
Alan Silver
(anything added below this line is nothing to do with me)
Homer J. Simpson - 20 Jul 2007 15:47 GMT
Oh, don't get me wrong--it took me no time at all to realize there's no
going back to classic ASP. Everything's such a kludge, I don't miss it at
all.
> Thanks for the idea. It's worth considering. You would need some central
> mechanism for controlling which page got which CSS file though, otherwise
> you would end up with a real mess.
As far as my current needs go, this is more than 'good enough'. A lot of my
CSS files are mapped to a single .aspx (eg, to override styles inherited
elsewhere for that page only, or to style a control that is unique to that
page), so I don't think this is gonna be much of an issue. Of course, I was
never involved with sites with more than a dozen pages. Learning any of
this is more of a side-line for me.
> Dunno. I tried adapting my classic ASP way of thinking, then realised that
> it was confusing rather than helping. I bought ASP.NET Unleashed by Steven
> Walther and treated myself as a beginner. It was one of the best books of
> it's type I ever read and got me going fast. I still use it sometimes.
I did approach this as a beginning myself, but I still can't help thinking
"I know how to do X, now how should it be done in ASP.NET"...this is what
I'd like to see in some book or tutorial.
> Trouble is, the "tried and true" method for classic ASP is often
> completely the wrong method for ASP.NET and vice-versa.
"Tried and true" might have been a poor choice of words on my part--there's
an awful lot of ugly hacks that we all came up with out of necessity, and
they should be dropped at the first chance...
> That's why I suggested approaching ASP.NET as a newbie, it avoids the
> problem of thinking you know the best way to do something, when really the
> way you have in mind might be completely inappropriate for ASP.NET. It
> really is a new (but highly (superior) way of thinking.
I don't disagree. But let me ask you this: Do you get the sense that MS is
trying to get ASP.NET developers to drop style sheets and go 100%
themes/skins instead? And if so, is sticking to style sheets "working
against the framework"? I'm starting to think I just need more examples.
Most books barely scratch the surface of this topic, or are little more than
references.
>>For one--and it's still early in my learning process--I find that ASP.NET
>>generates *way* more inline styles (as tag attributes) than I would ever
[quoted text clipped - 10 lines]
> ASP.NET handles it. I'd need to see a more concrete example before I could
> say though.
Meh. It's not such a big issue, all things considered-- I'd rather
concentrate on learning the more important features for now and get back to
this later.
> I do all of my presentation with CSS, so the .aspx file tends to be very
> vanilla (X)HTML and nothing more. That keeps the separation between
> content and presentation very well, making better structured pages and a
> much easier implementation of themes.
Great--that's what I'd try to do also. I guess it sorta answers my question
above as well...
Alan Silver - 22 Jul 2007 12:16 GMT
>> That's why I suggested approaching ASP.NET as a newbie, it avoids the
>> problem of thinking you know the best way to do something, when really the
[quoted text clipped - 5 lines]
>themes/skins instead? And if so, is sticking to style sheets "working
>against the framework"?
No, I don't get that impression. I have only used skins once. They are
OK, but I prefer to handle it all in style sheets. AFAICS, MS are quite
happy for people to use stylesheets only, I don't think they are pushing
us into skins.
> I'm starting to think I just need more examples. Most books barely
>scratch the surface of this topic, or are little more than references.
That's certainly true. I guess with al the other stuff in ASP.NET, this
gets pushed to the side a little.
One of the problems is that most ASP.NET developers are programmers, not
designers. CSS, themes and skins are really aimed at designers, so they
don't get as much attention as the coding.
Ta ra

Signature
Alan Silver
(anything added below this line is nothing to do with me)