473,543 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<head runat="server">

Why do we need runat="server" on our <headtags?
Sep 5 '08 #1
19 11209
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.co mwrote in message
news:ul******** ******@TK2MSFTN GP05.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.co mwrote in message
news:eW******** *****@TK2MSFTNG P06.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.nosp amwrote in message
news:uZ******** ******@TK2MSFTN GP02.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 misunderstandin g 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,tw o,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.co mwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
"Scott M." <s-***@nospam.nosp amwrote in message
news:uZ******** ******@TK2MSFTN GP02.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 misunderstandin g 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,tw o,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.nosp amwrote in message
news:uZ******** ******@TK2MSFTN GP02.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.co mwrote in message
news:eW******** *****@TK2MSFTNG P06.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.co mwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Scott M. wrote:
>Place this: <%="<meta name='keywords' content='one,tw o,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

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

Similar topics

3
9375
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 between the two, and when to use one instead of the other? Thanks.
1
1732
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 can have only one server-side Form tag" Is there a way to go around this?
4
4257
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 essentially the same thing (even copying the code from the other file) and i cannot access them from the code-behind file. Any clues what would...
1
3280
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 as this is the reason (security) that I want to restrict their selection. Any help on this one will be greatly appreciated. The page is using...
3
5512
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 what case I can (or must) use the second? If I want an input control that has specific font or color, I can use client side <input> so I'm...
3
3481
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 Beta 1, then Beta 2. I was using the <div runat="server"> statement on my projects. Once I placed a <div id="testdiv" runat="server"> within my...
0
1586
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 changed. If I take the <head runat="server" /> out of my userControl, my DynamicMenuItemStyle are fine. I tried it using a CSS file and class and a...
4
2892
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" ID="myForm" method=POST> so, first thing: how can I dynamically set the "Action" parameter? I know that with <asp:HiddenField...for example, I have...
1
2409
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 invalid for a strict implementation. <spanis in-line-level and <divis block-level. I don't want to mix up <span> and <div> I'm using an...
0
7410
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7744
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7691
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5887
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5276
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4896
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3392
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
639
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.