473,407 Members | 2,598 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,407 software developers and data experts.

Error In setting Master Page Header Info

Hi All,

I did follow the MSDN article (http://msdn2.microsoft.com/en-us/
library/ms379585(VS.80).aspx
) for overriding Master Page properties by setting page title and
other Meta information( Keyword and Description) for individual
content page by writing the following line on Page_Load event in
content page

Sub Page_Load()
Master.Page.Header.Title = "Content Title"
Master.Page.Header.Metadata.Add("Keywords", "blah,blah")
Master.Page.Header.Metadata.Add("Description", "blah,blah")
End Sub

But it is giving me the following error:
System.Web.UI.HtmlControls.HtmlHead' does not contain a definition for
Metadata

Is there any idea why it is happening as it is clearly written in MSDN
article or any simple workaround for it?

Thanks

Asif

Feb 8 '07 #1
1 1855
On Feb 8, 8:55 am, "Asif" <asif.im...@gmail.comwrote:
Hi All,

I did follow the MSDN article (http://msdn2.microsoft.com/en-us/
library/ms379585(VS.80).aspx
) for overriding Master Page properties by setting page title and
other Meta information( Keyword and Description) for individual
content page by writing the following line on Page_Load event in
content page

Sub Page_Load()
Master.Page.Header.Title = "Content Title"
Master.Page.Header.Metadata.Add("Keywords", "blah,blah")
Master.Page.Header.Metadata.Add("Description", "blah,blah")
End Sub

But it is giving me the following error:
System.Web.UI.HtmlControls.HtmlHead' does not contain a definition for
Metadata

Is there any idea why it is happening as it is clearly written in MSDN
article or any simple workaround for it?
In Beta 2 Version 2, the Header.Metadata.Add() method was removed from
the framework. This article is out of the date

Check this workaround from http://www.howtoadvice.com/SetMetaTags

//Get the htmlHead your aspx page is using (from the Master page)
//Master page must include the runat server attribute in the head tag:
<head runat="server">
HtmlHead head = (System.Web.UI.HtmlControls.HtmlHead)Header;

//Create a htmlMeta object
HtmlMeta meta = new HtmlMeta();

//Specify meta attributes
meta.Attributes.Add("name", "keywords");
meta.Attributes.Add("content", "keyword1, keyword2, keyword3");

// Add the meta object to the htmlhead's control collection
head.Controls.Add(meta);

Feb 8 '07 #2

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

Similar topics

20
by: Alan Silver | last post by:
Hello, In classic ASP, I used to use two include files on each page, one before and one after the main content, to provide a consistent layout across a web site. That way I could just change the...
4
by: Alan Silver | last post by:
Hello, I downloaded and registered VWD Express from the MS site, and this gave me a free download of a book called "Build A Web Site Now!", which is a (very light) introduction to VWD. In the...
17
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content...
7
by: xkeops | last post by:
Thinking of creating a website, most of the pages will have a general toolbar menu, a content and a footer. The content will be the only one who's gonna change but the rest (header,footer) will...
4
by: sck10 | last post by:
Hello, I have the following in my Master Page that I am using as a redirect template: <head id="headRedirect" runat="server"> <meta id="metaRedirect" http-equiv="Refresh" content="2;...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
6
by: Rippo | last post by:
Is it possible to turn off the title tag in the page directive when using master pages? We have got meta data and title defined in a content control and are ending up with 2 title tags, one...
4
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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,...

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.