TheGateKeeper
TheGateKeeper

Reputation: 4520

Reading and appending to master page titles?

what im trying to do is to read the current master page's title, and append something to it from the codebehind of the child page.

I tried to use:

this.Master.Page.Title.ToString()

But it returned null. Any ideas?

In the master page, here is how i set the title:

<head runat="server">
    <title>The Magic Finger - Web Design</title>
    <link href="App_Themes/Style.css" rel="stylesheet" type="text/css" />
</head>

Upvotes: 1

Views: 254

Answers (2)

7Ian
7Ian

Reputation: 49

Set the page title as normal in your Master Page. In your child page, use

    Me.Master.Page.Title &= " - This text will be appended"

Important: make sure you do not have "Title" as an attribute in the child page's .aspx. If you have this:

    <%@ Page Title="" Language=""

Make sure to remove the title attribute.

Upvotes: 0

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93424

Try Page.Title instead, the title is set by the content page.

Upvotes: 2

Related Questions