473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

<head runat="server">

Why do we need runat="server" on our <headtags?
Sep 5 '08 #1
19 11196
Scott M. wrote:
Why do we need runat="server" on our <headtags?
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
Sep 5 '08 #2
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" <gu***@guffa.comwrote in message
news:ul**************@TK2MSFTNGP05.phx.gbl...
Scott M. wrote:
>Why do we need runat="server" on our <headtags?

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

Sep 6 '08 #3
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
Sep 6 '08 #4
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" <gu***@guffa.comwrote in message
news:eW*************@TK2MSFTNGP06.phx.gbl...
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

Sep 6 '08 #5
"Scott M." <s-***@nospam.nospamwrote in message
news:uZ**************@TK2MSFTNGP02.phx.gbl...
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

Sep 6 '08 #6
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" <An***********@yadayadayada.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
"Scott M." <s-***@nospam.nospamwrote in message
news:uZ**************@TK2MSFTNGP02.phx.gbl...
>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

Sep 6 '08 #7
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
Sep 6 '08 #8
Allow me to jump in here with my 2 cents..

Starting .NET 2.0 @Page directive has a Title property (Page class has a
Title property).

Try to set it with out having <head runat=server>... You will get an error..
Also read documentation on Page.Title
"Use the Title property to set the page title in the HTML header sent to the
requesting browser.
Note The page must contain a <headelement with the attribute
runat="server", otherwise the title will not render."

PS: If you are not using Title property in your project then you (probably)
do not need to have <head runat=server>

George.


"Scott M." <s-***@nospam.nospamwrote in message
news:uZ**************@TK2MSFTNGP02.phx.gbl...
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" <gu***@guffa.comwrote in message
news:eW*************@TK2MSFTNGP06.phx.gbl...
>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

Sep 6 '08 #9
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?
"Göran Andersson" <gu***@guffa.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
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

Sep 6 '08 #10
So is the ability to use the @Page Title directive the only thing that
adding runat="server" to the head tag buys me?
"George" <no*****@comcast.netwrote in message
news:Ol*************@TK2MSFTNGP05.phx.gbl...
Allow me to jump in here with my 2 cents..

Starting .NET 2.0 @Page directive has a Title property (Page class has a
Title property).

Try to set it with out having <head runat=server>... You will get an
error.. Also read documentation on Page.Title
"Use the Title property to set the page title in the HTML header sent to
the requesting browser.
Note The page must contain a <headelement with the attribute
runat="server", otherwise the title will not render."

PS: If you are not using Title property in your project then you
(probably) do not need to have <head runat=server>

George.


"Scott M." <s-***@nospam.nospamwrote in message
news:uZ**************@TK2MSFTNGP02.phx.gbl...
>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" <gu***@guffa.comwrote in message
news:eW*************@TK2MSFTNGP06.phx.gbl...
>>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


Sep 6 '08 #11
YES and again if you are no using it then you do not need <head
runat=server>.
The Title property makes sense when used in conjunction with MasterPages.
When <HEADtag is in the MasterPage and each page needs to set custom Title
(Good for Google/Yahoo). So that was a Microsoft's way to let developers do
it (set custom title on page).
George.

"Scott M." <s-***@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
So is the ability to use the @Page Title directive the only thing that
adding runat="server" to the head tag buys me?
"George" <no*****@comcast.netwrote in message
news:Ol*************@TK2MSFTNGP05.phx.gbl...
>Allow me to jump in here with my 2 cents..

Starting .NET 2.0 @Page directive has a Title property (Page class has a
Title property).

Try to set it with out having <head runat=server>... You will get an
error.. Also read documentation on Page.Title
"Use the Title property to set the page title in the HTML header sent to
the requesting browser.
Note The page must contain a <headelement with the attribute
runat="server", otherwise the title will not render."

PS: If you are not using Title property in your project then you
(probably) do not need to have <head runat=server>

George.


"Scott M." <s-***@nospam.nospamwrote in message
news:uZ**************@TK2MSFTNGP02.phx.gbl...
>>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" <gu***@guffa.comwrote in message
news:eW*************@TK2MSFTNGP06.phx.gbl...
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


Sep 6 '08 #12
Thank you very much!
"George" <no*****@comcast.netwrote in message
news:OS****************@TK2MSFTNGP05.phx.gbl...
YES and again if you are no using it then you do not need <head
runat=server>.
The Title property makes sense when used in conjunction with MasterPages.
When <HEADtag is in the MasterPage and each page needs to set custom
Title (Good for Google/Yahoo). So that was a Microsoft's way to let
developers do it (set custom title on page).
George.

"Scott M." <s-***@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>So is the ability to use the @Page Title directive the only thing that
adding runat="server" to the head tag buys me?
"George" <no*****@comcast.netwrote in message
news:Ol*************@TK2MSFTNGP05.phx.gbl...
>>Allow me to jump in here with my 2 cents..

Starting .NET 2.0 @Page directive has a Title property (Page class has a
Title property).

Try to set it with out having <head runat=server>... You will get an
error.. Also read documentation on Page.Title
"Use the Title property to set the page title in the HTML header sent to
the requesting browser.
Note The page must contain a <headelement with the attribute
runat="server", otherwise the title will not render."

PS: If you are not using Title property in your project then you
(probably) do not need to have <head runat=server>

George.


"Scott M." <s-***@nospam.nospamwrote in message
news:uZ**************@TK2MSFTNGP02.phx.gbl...
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" <gu***@guffa.comwrote in message
news:eW*************@TK2MSFTNGP06.phx.gbl...
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


Sep 6 '08 #13
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
Sep 7 '08 #14
No, it's you who are missing the point.

I am quite sure that I am and I'm quite sure that you aren't explaining it
in a way that makes me get the point.

All you are saying is that it is requires so that content can be placed in
the head secation and I'm telling you that this can be done without
runat="server".

Anyway, thanks for trying.
Sep 7 '08 #15
Scott M. wrote:
>No, it's you who are missing the point.

I am quite sure that I am and I'm quite sure that you aren't explaining it
in a way that makes me get the point.

All you are saying is that it is requires so that content can be placed in
the head secation and I'm telling you that this can be done without
runat="server".
Yes, of course it's possible, but far from practical.

The way that you demonstated is to put a server control or an inline
code block inside the head tag, but that requires you to know where the
head tag is already. That can't be done automatically.

Another alternative is to loop through all the literal controls in the
page to locate the head tag. Then the string containing the head tag
could be parsed so that the string could be modified. Although possible,
it would be doing exactly what's done when you put runat="server" in the
head tag, only over and over again every time the header needed
modifying. The mechanism for parsing the code already exists, there is
no reason to do it in a different way for the head tag.
>
Anyway, thanks for trying.
--
Göran Andersson
_____
http://www.guffa.com
Sep 7 '08 #16
The way that you demonstated is to put a server control or an inline code
block inside the head tag, but that requires you to know where the head
tag is already. That can't be done automatically.
[sigh] Yes it can, it's been done for years by every HTML editor that wanted
to insert a <meta name="Generator" ...tag into the output.
Sep 7 '08 #17
Scott M. wrote:
>The way that you demonstated is to put a server control or an inline code
block inside the head tag, but that requires you to know where the head
tag is already. That can't be done automatically.

[sigh] Yes it can, it's been done for years by every HTML editor that wanted
to insert a <meta name="Generator" ...tag into the output.
[sigh] Yes, as I said, it's possible. It can be done, but it would be
stupid. It doesn't make sense to parse the code one extra time to find
the head tag, when the code has already been parsed once.

--
Göran Andersson
_____
http://www.guffa.com
Sep 7 '08 #18
So, your final response is that having this runat="server" in the head tag
gives me no more functionality that we've already had.

Gee, you could have said that like 12 posts ago.

"Göran Andersson" <gu***@guffa.comwrote in message
news:eF**************@TK2MSFTNGP06.phx.gbl...
Scott M. wrote:
>>The way that you demonstated is to put a server control or an inline
code block inside the head tag, but that requires you to know where the
head tag is already. That can't be done automatically.

[sigh] Yes it can, it's been done for years by every HTML editor that
wanted to insert a <meta name="Generator" ...tag into the output.

[sigh] Yes, as I said, it's possible. It can be done, but it would be
stupid. It doesn't make sense to parse the code one extra time to find the
head tag, when the code has already been parsed once.

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

Sep 8 '08 #19
Scott M. wrote:
So, your final response is that having this runat="server" in the head tag
gives me no more functionality that we've already had.

Gee, you could have said that like 12 posts ago.
I did.

--
Göran Andersson
_____
http://www.guffa.com
Sep 8 '08 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael | last post by:
There seem to be two ways to include files on the server: 1. <!-- #include file="header.inc" --> 2. <script language="VBScript" runat="server" src="header.inc"></script> What are the differences...
1
by: Hai Nguyen | last post by:
Hi all I have a several User Controls which require this tag: "<form runat="server">. I tried to have all of these user user controls on the same web page. It kept giving me an error :""A page...
4
by: Tim Mulholland | last post by:
I have one page where i have some <div> tags set to be runat="server" (and i've given them an id) and i can access them from the code-behind file just fine. I have another page where i've done...
1
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done by design (security reasons). I find that irronic...
3
by: Jaime Stuardo | last post by:
Hi all... Both controls are server side. The former has more properties. Both may have associated events that are ran at server. Which one are recommended to use? is performance an issue? in...
3
by: Jim in Arizona | last post by:
Most of the asp.net learning I've done has been from books that were written during the 1.0 framework. I didn't have a copy of visual studio when I started reading them then I got a hold of VS 2005...
0
by: Tom | last post by:
I need to use DynamicHoverStyle. I read that in order to do so, I must add a <head runat="server" /> at the top of my UserCOntrol. When I do this though, my DynamicMenuItemStyle items get...
4
by: Kevin Blount | last post by:
bit long winded this one, so stick with me: I'm trying to create a form that can go to one of 3 places, depending on various elements. My form control looks like this: <form runat="server"...
1
by: mark4asp | last post by:
<form runat="server"automatically adds <divtag to code contained within. Is there a way to stop that? Mixing block-level elements with inline-level elements messes up the HTML becasuse that is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.