Skip to main content

Thinking out aloud - Dave Hunter's SharePoint Blog

Go Search
Home
Blog
  

Locations of visitors to this page


 Useful Links

  Microsoft UK events
  SharePoint 2007 on CodePlex
  SharePoint Community Portal
  SharePoint User Group
  SharePoint Community Portal
  SharePoint Pedia
  SharePoint MSDN Forums
  SharePoint University
Home > Thinking out aloud - Dave Hunter's SharePoint Blog > Posts > Display a page without any navigation
My thoughts and findings on Microsoft Information worker technologies, including MCMS and SharePoint 2007 (MOSS).
Display a page without any navigation

It's a common requirement to want a page which is print friendly or a page which doesn't display any navigation.  I had a similar requirement for a tree view control to be displayed with scrollbars, at first you may not think these are related, but the way I designed it to cater for the scrollbars made it similar.  I split this requirement into two parts: 1. The tree view control and 2. Using the Page Viewer webpart and displaying a page without navigation, header and footer (just the contents).

I will cover the treeview control in another post.  As for displaying a page without any navigation, header and footer.  In the previous version of SharePoint it was typical practice to hide elements of the page using CSS.  I used the same approach to achieve this.  In the past I've used the Style Under Cursor DWP and highly recommended it to find out CSS classes and hierarchal structural elements.  With this information you can then hide elements using .className { display:none !IMPORTANT; }.  This CSS can be added to a separate stylesheet that you add or by using a content editor webpart.  I chose the last option, the content editor webpart. 

If you look at the core.css and search for @media you will find a print section, which hides some of structural elements of the page when you print the page or use the print preview.  This gave me a start and then it was just finding out which other elements I needed to hide.

The following hides the left hand navigation, header, right hand side and footer from SharePoint V3 site using the default.master.

<style>
.ms-leftareacell,.ms-globallinks,.ms-siteaction,.ms-areaseparatorleft,.ms-rightareacell,.ms-areaseparatorright,
.ms-areaseparatorcorner,.ms-titlearealeft,.ms-titlearearight,.ms-searchform,.ms-banner,.ms-buttonheightwidth,
.ms-buttonheightwidth2, .ms-globalTitleArea, .ms-globalbreadcrumb, .ms-bannerContainer, .ms-pagetitleareaframe,
.ms-consolestatuscell, .ms-pagemargin, .ms-bodyareapagemargin, .ms-pagebottommarginleft,
.ms-pagebottommarginright, .ms-pagebottommargin, .ms-titleareaframe { display:none !IMPORTANT; } .ms-bodyareaframe, .ms-bodyareacell, .ms-propertysheet { border:0px !IMPORTANT; } /* doc viewer related styles */ .docLibViewer a{ margin-left: 2px;margin-right: 2px; } .docLibViewer img { margin-left: 2px;margin-right: 2px; } </style>

Adding CSS using a Content Editor Web Part

This renders the page like this.

Page with CSS hiding the navigation etc 

I then added a page viewer webpart and pointed this to the page containing the tree view control.

Homepage with Tre View

The final result looks good.

  Copyright
This work is licenced under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.0 UK: England & Wales License
  Site Map

Comments

brilliant

Thank you soooooooooo much.
at 21/05/2009 23:36

 Dave Hunter

I'm currently a Senior Consultant at Netstore 2e2. I specialise in Microsoft Information Worker technologies (especially MOSS, MCMS and .NET), with over 8 years of experience within this area of specialism. 

I have gained two certifications for MOSS and WSS and look to complete the full certification track soon.

View Dave Hunter's profile on LinkedIn

  Subscribe in a reader


 Latest Posts

I’m attending the first ever SharePoint Saturday in the UK31/08/2010 19:43
I’ve re-joined CIBER UK31/08/2010 19:26
I’ve been Awarded a MVP for SharePoint01/04/2010 19:49
SharePoint 2010 Training on Microsoft E-Learning15/03/2010 17:56
SharePoint UK User Group - Thursday 27th August London Meeting25/08/2009 17:56
CAML Query that filters on the current user23/07/2009 17:50
Microsoft Ramp Up Free SharePoint Developer Training22/07/2009 20:59
How To: Change a SharePoint Application Pool Programmatically07/07/2009 18:08
SharePoint Forums Topping 100 Answers06/07/2009 12:29
Find out the SharePoint Internal Name for a Column or Site Column28/05/2009 09:56
1 - 10 Next