views:

128

answers:

1

Hi,

How can I set the page title in asp.net mvc using strongly typed views AND a master page.

I added a public property to my master page class, but can't seem to get access to it in my view/action.

+5  A: 

Setup a placeholder in the head of your master page:

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

Then in your view pages add an asp:Content section:

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%= Model.Title %>
</asp:Content>
Jim