|
|
|
date: Fri, 5 Sep 2008 14:28:23 -0400,
group: microsoft.public.dotnet.framework.aspnet
back
Re: <head runat="server">
Scott M. wrote:
> Well, I understand what runat="server" means in general, but we haven't
> always had that in .NET and the server never had any trouble adding tags to
> the head section before.
In framework 1 it didn't add anything to the head.
> What, specifically, does the head tag need this
> for? Why does the server need to be able to access the head tag as a server
> object?
It's only needed if you use anything that actually adds something to the
head section, like themes or the Title property.
If the head tag wouldn't be a server control, it would be in a string in
a LiteralControl object in the page. In order for the Title property to
set the title in the head, it would have to locate the LiteralControl
containing the head tag and parse the string to find out which part of
the string contained the head tag, and if it aleady contained a title
tag or not.
>
> "Göran Andersson" wrote in message
> news:ulS$8b6DJHA.1272@TK2MSFTNGP05.phx.gbl...
>> Scott M. wrote:
>>> Why do we need runat="server" on our <head> tags?
>> So that the head tag will be parsed into a server control, so that the
>> server code can access it.
>>
>> Without the attribute the tag would just be treated like literal text, and
>> the server code could not easily add tags inside the head tag.
>>
>> --
>> Göran Andersson
>> _____
>> http://www.guffa.com
>
>
--
Göran Andersson
_____
http://www.guffa.com
date: Sat, 06 Sep 2008 11:25:55 +0200
author: Göran Andersson
Re: <head runat="server">
"Göran Andersson" wrote in message
news:u4rpTKAEJHA.4904@TK2MSFTNGP06.phx.gbl...
> Scott M. wrote:
>> Well, I understand what runat="server" means in general, but we haven't
>> always had that in .NET and the server never had any trouble adding tags
>> to the head section before.
>
> In framework 1 it didn't add anything to the head.
Yes it did, it added <meta> tags.
>
>> What, specifically, does the head tag need this for? Why does the server
>> need to be able to access the head tag as a server object?
>
> It's only needed if you use anything that actually adds something to the
> head section, like themes or the Title property.
Uh no. We've been able to modify the page titile without the runat="server".
>
> If the head tag wouldn't be a server control, it would be in a string in a
> LiteralControl object in the page. In order for the Title property to set
> the title in the head, it would have to locate the LiteralControl
> containing the head tag and parse the string to find out which part of the
> string contained the head tag, and if it aleady contained a title tag or
> not.
If the title tag needs to be accesses via the sever, then why not just add
runat="server" to the title tag? As far as being able to add any
informaiton into the head section, you don't need runat="server" to do that.
You could simply place a literal contrin somewhere inside the head section.
I'm sorry, but your responses don't seem to reall explain why this is needed
since everything you've said it's for has been accomplished without it for
years. Adding runat="server" makes that particular element programmable at
the server. Why would I need/want to program the head tag at the server?
Obviously, someone at Microsoft feels that this is so important that all VS
2008 generated pages get the head tag marked with this attribute.
-Scott
>
>>
>> "Göran Andersson" wrote in message
>> news:ulS$8b6DJHA.1272@TK2MSFTNGP05.phx.gbl...
>>> Scott M. wrote:
>>>> Why do we need runat="server" on our <head> tags?
>>> So that the head tag will be parsed into a server control, so that the
>>> server code can access it.
>>>
>>> Without the attribute the tag would just be treated like literal text,
>>> and the server code could not easily add tags inside the head tag.
>>>
>>> --
>>> Göran Andersson
>>> _____
>>> http://www.guffa.com
>>
>>
>
>
> --
> Göran Andersson
> _____
> http://www.guffa.com
date: Sat, 6 Sep 2008 11:30:44 -0400
author: Scott M. am
Re: <head runat="server">
Scott M. wrote:
> You miss my point. Call it what you want, but I am able to gain access to
> the content that will be rendered in the head section without
> runat="server". So, my question still stands: What does runat="server" in
> the head tag buy me that I didn't have before it?
No, it's you who are missing the point.
You can add content in the actual head, not just in a container that you
have placed in the head.
This is required to use any built in features, like themes, that need to
put code in the head.
If you get an error message that tells you that runat="server" is
required in the head tag, it's because you are using some of the built
in fetures that needs to put code in the head. The error message also
tells you exactly what it is that you are using, so if you don't want to
use that featue, you don't net to put runat="server" in the head tag.
--
Göran Andersson
_____
http://www.guffa.com
date: Sun, 07 Sep 2008 15:01:27 +0200
author: Göran Andersson
|
|