RSS
Add to Technorati Favorites
Follow me on Twitter


Becky Bertram's Blog > Posts > Person.aspx Navigation
Person.aspx Navigation

For those of you who might have noticed, the top navigation disappears when you're viewing someone else's profile using the Person.aspx page. This behavior seems very mysterious, considering the navigation appears on the other pages in the root "My Site" site collection.

I ran across this post on Bob Moore's blog, where he describes how he disassembled the code and discovered that there's code in Person.aspx that explicitly looks for the Content control that contains the top navigation, and then hides it! ("Oh Microsoft, why dost thou vex me so?!") (You'll need to scroll down the page to view his article called "You are not the person.aspx I thought you were!")

Because the code is fairly "stupid" in the sense that it's looking for placeholder controls with specific names (PlaceHolderTopNavBar, PlaceHolderHorizontalNav, and TopNavigationMenu), you can side-step this behavior by creating an alternative ContentPlaceHolder control in your Master Page that you can use in Person.aspx. Then, in Person.aspx, you'll simply override the existing PlaceHolderTopNavBar placeholder from the Master Page, leaving it blank. (Although the custom code in Person.aspx will hide the top nav, it will leave the Site Actions menu, so if you don't explicitly override the content placeholder control with empty content, you'll get the Site Actions menu twice.)

For example, I added this control directly above the PceHolderTopNavBar ContentPlaceHolder control in my Master Page:

<asp:ContentPlaceHolder id="PlaceHolderTopNavBarPerson" runat="server"/>

As you can see, it's an empty control, so it won't display any markup on any of the existing My Site pages.

In the Person.aspx page, I added the following empty placeholder control to the page:

<asp:Content ContentPlaceHolderId="PlaceHolderTopNavBar" runat="server"/>

Then, I added my new control.

<asp:Content ContentPlaceHolderId="PlaceHolderTopNavBarPerson" runat="server"/>

I basically copied and pasted all the markup that's inside the PlaceHolderTopNavBar ContentPlaceHolder control in the Master Page, (making sure to remove the <asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server"> and </asp:ContentPlaceholder> tags that were embedded in it), and put that markup inside my new "PlaceHolderTopNavBarPerson" Content control.

Modifying actual "My Site" site collections for different users means you're modifying multiple site collections, and it's best to use a Feature Stapler. However, since Person.aspx is a singular page in the root My Site site collection, I don't see any big problem with customizing Person.aspx from the original version, to add in the alternative Content controls.

If you're already using a Feature to apply a custom Master Page to all your My Site site collections, there's no reason why you couldn't just add the additional ContentPlaceHolder control to your custom Master Page, and then activate your Feature in the root My Site site collection. Otherwise, you could easily modify the Master Page using SharePoint Designer in the root My Site site collection.

Comments

Good article but have questions.

I am trying to create custom master page and custome pages (myperson.aspx etc)  and active feature on MySite collection. and also I am writing custommodule to redirect from Person.aspx to myperson.aspx page. Will this work? I am thinking myperson.aspx is the same scope that Person.aspx.

So I can have user information. I want you email id. So I can contact you more on this.

More Information

By Master Page, you mean the MY Sites Master page? I dont have ContentPlaceHolderId="PlaceHolderTopNavBarPerson" on my MY site host default.aspx. I am under the gun in figuring this out, so any explicit info you could offer would greatly help. If there is code to hide the top nav bar, can you not just delete the code that hides it?

Thanks

Response

Sean,
Thanks for your interest in my blog.
Yes, I am talking about the Master Page in the root of the My Site root site collection. If you read the article, it says, “For example, I added this control directly above the PceHolderTopNavBar ContentPlaceHolder control in my Master Page: <asp:ContentPlaceHolder id="PlaceHolderTopNavBarPerson" runat="server"/>”
You won’t have that placeholder there until you explicitly add it to the page, like the article is telling you to do.
You can’t just delete the code, because it’s part of the compiled SharePoint dll.
Good luck.

RE: More Info

Thanks for responding Becky.
I'm sorry, I meant to say that I dont have PceHolderTopNavBar Content PlaceHolder on my master page, it actually has less than 15 lines of code on it, which is surprising. Once again, and sorry to be repetitive, but this is the default.aspx file in the SPSMSITEHOST folder, correct?

And back to Bob Moore's solution rather than deleting the code can I change master.visible=false to master.visible=true, like he did? And if I did, where is this code? I cant find it in person.aspx.
I have no preference to which solution I use, yours or his, just whatever works. Thanks again, Becky

Add a New Tab on My Home

I am trying to add a new tab between the My Home and My Profile on My Site. I can add a new link from the Center Administration but when i click on the new tab a new page opens. I need it to open within the same frame.

How do I do this?

Thanks
c

More Info

And back to Bob Moore's solution rather than deleting the code can I change master.visible=false to master.visible=true, like he did? And if I did, where is this code? I cant find it in person.aspx.
I have no preference to which solution I use, yours or his, just whatever works. Thanks again, Becky
 

Comment Title *


Your Name


Body *


Your E-mail Address


Your Website

Type the Web address: (Click here to test)  

Type the description: 

Post Date *

Post Title *