views:

25

answers:

1

Ok, I'm sure it must be a silly mistake on my part, but I can't find where the problem is, and it's driving me nuts.

I have a master page, with this:

<head runat="server">
    <title>
       <asp:ContentPlaceHolder ID="TitleContent" runat="server" /> - Company
    </title>
</head>

It's just the default HTML inserted by VS when I created the masterpage, I just added " - Company" at the end, so that I don't have to repeat that text in every single view.

On the views, I have, for example, this:

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Some title for the view
</asp:Content>

As you can imagine, the final result is not what I expected. Instead of

<title>Some title for the View - Company</title>

I'm getting:

<title>Some title for the View</title>

Why?

A: 

You have closed the title tag twice. Also, try not having the ContentPlaceHolder be self closing.

In MVC, I don't recall ever using the ContentPlaceHolder. I strongly type my master page and populate the master page that way.

Anthony Potts
Fixed the title tag (I made the mistake when formatting the code for SO, it's actually ok in the original code). I already tried using </asp:ContentPlaceHolder> instead of self closing, but I get the same result.
salgiza