Using ASP.Net MVC on my Site.Master I have:
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /> - MySite</title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
</head>
then on each view I have something like:
<asp:Content ID="Title" ContentPlaceHolderID="TitleContent" runat="server">
Home
</asp:Content>
and I was expecting, as a result:
<title>Home - MySite</title>
but instead I've got:
<title>Home</title>
Any ideas why?
Use this:
<title>
<asp:ContentPlaceHolder ID="titleContent" runat="server" />
<%= "- My Site" %>
</title>
The reason is that everything rendered in the head is rendered as a control.
See this question for some further links, and other ways of solving it.
You may have a Title attribute in the <%@ Page %> directive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With