2008-06-24

Conditionally hidding/showing html/controls; SPSecurityTrimmedControl, Custom Wrappers, EditModePanel, SuppressWebPartChrome (SharePoint 2007)

In a recent case I've investigated a bit on different ways of hiding or showing GUI elements (html, controls, etc) bases on different conditions. There are several ways, and here are an overview of some of these:
  • SPSecurityTrimmedControl. Trimming the UI base on the current user's permissions. Possible values for the different parameters; read a blog entry from Zac Smith, or this one.
    - Showing different content for authenticated and anonymous users: read her.
    - Hiding the sita actions menu: read her.
  • Enhanced SPSecurityTrimmedControl. Open all the possibilities you can think of... (winsmarts.com)
  • Creating your own custom wrappers. Do it all yourself! (Waldek Mastykarz)
  • EditModePanel. Display different controls and elements if the page is in Edit or Display mode (WCM). Can be used to hide navigation, adding inline CSS to override classes to use different formating... (Chris O'Brien)

Related to html filtering and cleansing:

  • SuppressWebPartChrome to remove all extra html-code and display ONLY the content. Web part property. Check out Waldek Mastykartz article.
  • Remove or clean non-compliant html - override the Render method; read here.

Hiding elements when printing:

  • Using javascript to hide parts of the dom-tree in Javascript and a printer friendly button is mots often used.
  • CSS 2 styling and different style sheets for different medias are another. Read here.

2008-06-05

How to avoid 'Read-Only Mode' when opening documents in SharePoint 2007 (Word 2003, Word 2007, etc)

This has to be done on the client side. SharePoint has not the control of the client.

Read Mart Muller's blogg entry on the issue, or the KB article, and how to fix the issue.