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

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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.
 
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
 
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.
 
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.)
 
Back
Top