what is the use of runat="server" in aspx page header tag

Posted by Vikash under ASP.NET on 9/23/2012 | Points: 10 | Views : 10738 | Status : [Member] | Replies : 7
Hi all
My question is that what is the use of putting <head runat="server"></head> in header tag of asp.net Web Form

Regards,
Vikash Pathak



Responses

Posted by: Hariinakoti on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
Hi vikash,
y u r using runat=" server" for <head>? no need to use runat="server" for <head>.can u give explanation for that?

Thanks & Regards
Hari

Vikash, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikash on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
Dear All
A simple answer....

Remove runat="server" in head element and use CSS inside your Themes folder in your website..

I m sure.. we cant use...

Regards,
Vikash Pathak

Vikash, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/24/2012 [Member] Bronze | Points: 25

Up
0
Down
if you are using master pages, do not use <head runat="server"> inside child page... you can add necessary header tags in

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content>

if you do not have any master page, then make sure whether <head runat="server"> tag is not repeating.

Vikash, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/24/2012 [Member] Bronze | Points: 25

Up
0
Down
Mark as answer if it helpful to you.. That helps others who search the same..

Vikash, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vikash on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Mushinathk
If you are using Master page then there will not be any head tag in content page, so there is no question to put <head runat="server"> in content page. So my question is still remaining unanswered.

Regards,
Vikash Pathak

Vikash, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pgayath on: 9/24/2012 [Member] Starter | Points: 25

Up
0
Down
Vikash:

Please have a look at this. Hope this helps!

The head element contains a runat="server" attribute, which indicates that it is a server control (rather than static HTML). All ASP.NET pages derive from the Page class, which is located in the System.Web.UI namespace. This class contains a Header property that provides access to the page's region. Using the Header property we can set an ASP.NET page's title or add additional markup to the rendered section. It is possible, then, to customize a content page's element by writing a bit of code in the page's Page_Load event handler.

' Programmatically add a <meta> element to the Header
Dim keywords As New HtmlMeta() 

keywords.Name = "keywords"
keywords.Content = "master page,asp.net,tutorial"
Page.Header.Controls.Add(keywords)

http://www.asp.net/web-forms/tutorials/master-pages/specifying-the-title-meta-tags-and-other-html-headers-in-the-master-page-vb


Vikash, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sharadpatil on: 10/5/2012 [Member] Starter | Points: 25

Up
0
Down
Thanks Pgayath...very helpfull ur link...

Vikash, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response