I have created HTML template for my SharePoint site. On top of this site I want to display main navigation but I don't know the code to place which will display navigation.

I know under "Site Settings" there is "Navigation" option but I am looking for a code something like below which will display default navigation and then I can customize it according to my needs.


So I need that code which I will copy paste in the area in my HTM where I want default navigation to appear.


Assuming you are using SharePoint 2010, the top navigation bar is a SharePoint:AspMenu control with it's data source set to the SPNavigationProvider. Your easiest approach may be to pull up a masterpage like v4.master in SharePoint Designer and look for the SharePoint:AspMenu control with the CssClass called s4-tn and look for it's SiteMapDataSource which is noramlly right below it--the AspMenu control will have a DataSourceID attribute with the name of the SiteMapDataSource. Just copy that code block into your new page. The one thing to keep in mind is that this approach only works in ASPX based pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.