set <title> and <meta name='description'> with master page

G

Guest

Hi;

If I am using master pages, how do I set the <title> and <meta
name='description' content='my title'> for each page. Obviously each page
will have a different title & description.
 
G

GregG

David Thielen said:
Hi;

If I am using master pages, how do I set the <title> and <meta
name='description' content='my title'> for each page. Obviously each page
will have a different title & description.

Hi,
The title is a no-brainer - i.e.:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="xxxx.aspx.vb"
Inherits="xxxx" Title="My Page Name" %>

The meta-data I'm not sure of. We haven't had a reason to try that.
Have you read the mini-MSDN help?

FWIW,

Greg G.
 
C

clintonG

There's some new classes in 2.0...

// Add meta tags
//HtmlMeta meta1 = new HtmlMeta();
//meta1.Attributes.Add("description", "blah blah blah");
//HtmlHead head = (HtmlHead)Page.Header;
//head.Controls.Add(meta1);

<%= Clinton Gallagher
 
G

Guest

I thought anything outside the <asp:Content...> was off-limitis - thanks

And no - what is the mini-MSDN help? I have watched the videos and those are
great BTW.
 
S

Steven Cheng[MSFT]

Hi Dave,

When using Master page, since the the master template is protected from
being modified in concrete page, it does somewhat limit some setting in the
master template. However, there still open the programmatic approach, e.g:

protected void Page_Load(object sender, EventArgs e)
{
Page.Title = "conPage";

HtmlMeta meta1 = new HtmlMeta();

meta1.Content = "JavaScript";
meta1.Name = "vs_defaultClientScript";

Page.Header.Controls.Add(meta1);
}

Also, concrete page's Title can be configured in the @Page directive also.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top