Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > <head runat="server">

Reply
Thread Tools

<head runat="server">

 
 
Scott M.
Guest
Posts: n/a
 
      09-05-2008
Why do we need runat="server" on our <head> tags?


 
Reply With Quote
 
 
 
 
Göran Andersson
Guest
Posts: n/a
 
      09-05-2008
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
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      09-06-2008
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. 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?


"Göran Andersson" <(E-Mail Removed)> wrote in message
news:ulS$(E-Mail Removed)...
> 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



 
Reply With Quote
 
Göran Andersson
Guest
Posts: n/a
 
      09-06-2008
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" <(E-Mail Removed)> wrote in message
> news:ulS$(E-Mail Removed)...
>> 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
 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      09-06-2008

"Göran Andersson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:ulS$(E-Mail Removed)...
>>> 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



 
Reply With Quote
 
Göran Andersson
Guest
Posts: n/a
 
      09-06-2008
Scott M. wrote:
> I'm sorry, but your responses don't seem to reall explain why this is needed


Well, I tried to explain, but if you choose not to believe me you can
just... well... whatever...

--
Göran Andersson
_____
http://www.guffa.com
 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      09-06-2008
It's not about believing you. You just haven't provided an ansswer that
explains anything. You're answer is that it is needed to be able to add
things into the head section and since we've been able to do that since .NET
1.0 (and even classic ASP), I don't see how that can be the case.

You may well be right, but I'm looking for an answer that explains why it is
needed now, since it wasn't before.


"Göran Andersson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Scott M. wrote:
>> I'm sorry, but your responses don't seem to reall explain why this is
>> needed

>
> Well, I tried to explain, but if you choose not to believe me you can
> just... well... whatever...
>
> --
> Göran Andersson
> _____
> http://www.guffa.com



 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      09-06-2008
"Scott M." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> It's not about believing you. You just haven't provided an ansswer that
> explains anything. You're answer is that it is needed to be able to add
> things into the head section and since we've been able to do that since
> .NET 1.0 (and even classic ASP), I don't see how that can be the case.
>
> You may well be right, but I'm looking for an answer that explains why it
> is needed now, since it wasn't before.
>


Can you post a chunk of ASP.NET 1.1 that does what you mean?

Your comment that 'even classic ASP' could do it seems to indicate that
there is a misunderstanding in this thread. Code usually helps clear things
up. (I prefer to speak in VB or C# myself rather English, less likely to be
mis-interpreted

--
Anthony Jones - MVP ASP/ASP.NET

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      09-06-2008
Place this: <%="<meta name='keywords' content='one,two,three' />"%> in
between the opening and closing head tags and you get a meta tag. Not to
mention, that since most IDE's have been generating custom meta tags (with
the code generator flagged in the tag) for years, I'm having trouble
understanding why we need runat="server" to get at an area that IDE's have
always been able to get to.





"Anthony Jones" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "Scott M." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> It's not about believing you. You just haven't provided an ansswer that
>> explains anything. You're answer is that it is needed to be able to add
>> things into the head section and since we've been able to do that since
>> .NET 1.0 (and even classic ASP), I don't see how that can be the case.
>>
>> You may well be right, but I'm looking for an answer that explains why it
>> is needed now, since it wasn't before.
>>

>
> Can you post a chunk of ASP.NET 1.1 that does what you mean?
>
> Your comment that 'even classic ASP' could do it seems to indicate that
> there is a misunderstanding in this thread. Code usually helps clear
> things up. (I prefer to speak in VB or C# myself rather English, less
> likely to be mis-interpreted
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>



 
Reply With Quote
 
Göran Andersson
Guest
Posts: n/a
 
      09-06-2008
Scott M. wrote:
> Place this: <%="<meta name='keywords' content='one,two,three' />"%> in
> between the opening and closing head tags and you get a meta tag. Not to
> mention, that since most IDE's have been generating custom meta tags (with
> the code generator flagged in the tag) for years, I'm having trouble
> understanding why we need runat="server" to get at an area that IDE's have
> always been able to get to.
>


That's not specifically adding a meta tag in the head tag, that is just
adding a literal string among other literal strings.

If you want to create all the response as string literals, you don't
need any server controls at all.

--
Göran Andersson
_____
http://www.guffa.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments