>http://www.pluralsight.com/blogs/ted/archive/2005/08/31/14437.aspx
No disrespect to anyone, but I don't see why people make such heavy work
out of adding stylesheets, meta tags, etc when using master pages.
Sure you can jump through hoops like this, but it's way easier just to
have a contentplaceholder in the <head> section of the (X)HTML in the
master page, then on content pages where you want to something, you just
use a content tag and insert the code.
For example, the top of a master page could look like this...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head runat="server">
<title>Untitled Page</title>
<asp:ContentPlaceHolder ID="cplHead" runat="server" />
</head>
<body>
....and the content page would include this...
<asp:Content ContentPlaceHolderID="cplHead" runat="server">
<link href="fred.css" ..../>
<meta name="ferret" content="furry" />
</asp:Content>
This is *much* easier than using the ASP.NET objects to modify the
<head> programmatically.
HTH

Signature
Alan Silver
(anything added below this line is nothing to do with me)
Vince - 30 Aug 2007 14:31 GMT
On Aug 30, 6:43 pm, Alan Silver <alan-sil...@nospam.thanx.invalid>
wrote:
> In article <#6Gx1#j6HHA....@TK2MSFTNGP02.phx.gbl>, gerry
> <g...@nospam.nospam> writes
[quoted text clipped - 35 lines]
> Alan Silver
> (anything added below this line is nothing to do with me)
Thats a nice and clean approach. Thank you Alan!
vMike - 30 Aug 2007 16:16 GMT
>>http://www.pluralsight.com/blogs/ted/archive/2005/08/31/14437.aspx
>
[quoted text clipped - 28 lines]
>
> HTH
No disrespect taken. I think it depends a lot on how much flexibly you
need. If it you are trying to build an app that is going to have a lot of
flexibility, I prefer properties.
Mike
Alan Silver - 30 Aug 2007 16:56 GMT
>> This is *much* easier than using the ASP.NET objects to modify the <head>
>> programmatically.
>
>No disrespect taken. I think it depends a lot on how much flexibly you
>need. If it you are trying to build an app that is going to have a lot
>of flexibility, I prefer properties.
Out of interest, why? Having the <head> stuff inside a content tag still
allows flexibility. I showed a static way to do it, but there's nothing
wrong with putting a Literal control in the <head> content tag and
setting the stylesheet dynamically. Works the same as a property, but
much simpler IMO.
I'd be interested to hear why you prefer properties.
Ta ra

Signature
Alan Silver
(anything added below this line is nothing to do with me)
vMike - 30 Aug 2007 18:10 GMT
>>> This is *much* easier than using the ASP.NET objects to modify the
>>> <head>
[quoted text clipped - 13 lines]
>
> Ta ra
I find it easier to code. I admit that setting the style sheet is not the
best example for using properties. I use it for setting menus, titles and
body attributes. Maybe it is just a preference thing.
Mike
Alan Silver - 30 Aug 2007 18:47 GMT
<snip>
>> I'd be interested to hear why you prefer properties.
>
>I find it easier to code. I admit that setting the style sheet is not the
>best example for using properties. I use it for setting menus, titles and
>body attributes. Maybe it is just a preference thing.
OK, for titles and body attributes it could be sensible, although I
often bung a Literal in the <title> tag and do the same thing! Horses
for courses I guess.
Ta ra

Signature
Alan Silver
(anything added below this line is nothing to do with me)
Alexey Smirnov - 31 Aug 2007 09:34 GMT
On Aug 30, 7:47 pm, Alan Silver <alan-sil...@nospam.thanx.invalid>
wrote:
> In article <nSCBi.24444$7e6.10...@bignews4.bellsouth.net>, vMike
> <Michael.Geo...@5nerrawgenospam.com> writes
[quoted text clipped - 15 lines]
> Alan Silver
> (anything added below this line is nothing to do with me)
I think this is just a preference thing and a matter of the
architecture. I can say, if MasterPage has to be different for
different sets of content pages, than it is not really a "master". In
this case you can also have MasterPage2 with different CSS on it and
you can use it for that set of content pages where the style should be
different.
Alan Silver - 31 Aug 2007 11:31 GMT
>On Aug 30, 7:47 pm, Alan Silver <alan-sil...@nospam.thanx.invalid>
>wrote:
[quoted text clipped - 18 lines]
>you can use it for that set of content pages where the style should be
>different.
Could be, although I have had cases where one particular page required
extra CSS, and I didn't want to include that in the CSS for every page,
so I just added an extra link in the header for that one page. Certainly
wasn't worth doing a new master page for just that.
Ta ra

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