views:

201

answers:

2

I have a custom masterpage in sharepoint and want to output the site title in a different part of the page. Currently I can see the site title which is outputted using the following code:

<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" Visible="true" />

Apparently using

<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" Visible="true" />

Should also output the title but is returning nothing. Any ideas what is going wrong?

+1  A: 

This can be done by using the ProjectProperty control (see http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.projectproperty.aspx)

<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server">
   <SharePoint:ProjectProperty property="Title" runat="server" />
</asp:ContentPlaceHolder>
naivists
+2  A: 

The Code you have mentioned are the Content Place Holders where you can replace the Content, You can place the register the below tag in the top the page and

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 

And place the below code to get the Title of the Page

    <SharePoint:ProjectProperty Property="Title" runat="server" />

If you want to do that in the master page level you can do with the below code

<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" Visible="true">
 <SharePoint:ProjectProperty Property="Title" runat="server" />
 </asp:ContentPlaceHolder>

Unless you override the above content place holder you will get the Title of the Web Automatically

Kusek