Posts Tagged ‘content Editor’
Developing SharePoint 2007 sites from the outside in…
Tuesday, November 11th, 2008
Three handy tips for developing your MOSS site from the outside in:
1. Redirecting using the Content Editor Web Part
The “Content Editor Web Part” described in the web-part gallery as being used “for formatted text, tables, and images” is actually a handy way to embed HTML into a site page. One very handy use is to redirect users to another page , useful when a site has moved.
2. Filtering Data View hyperlinks into a Document View web part
SharePoint Designer allows you to attach a ‘Data View‘ to a SharePoint page. The standard Data View webpart is actually a rather powerful little feature which can retrieve data from various connectible sources, including other SharePoint lists. Handy if, say, you have a top level site with a list and want to feed/display the data to various sub-sites.
Data Views allow you to display list data in various ways; as text, links or even check boxes and images.
I was asked, as a fairly reasonable request, to create a set of maintainable “virtual folders” in a web part. The user wanted to be able to click on an item in a list and a “document list web part” on the same page would be ‘filtered’ to show the documents in that ‘folder‘. What is actually happening is nothing more than the filtering in the standard list view, but it allows the sub-site manager to choose what appears in the ‘virtual folder’ list, in this case a set of client/customer names.
After tearing my hair out, I eventually figured out that a Data View can be used to display the list items, which appear as links. The links point to the same page as the document list web part. When you choose to display Data View data as hyperlinks in SharePoint designer you will be able to edit the ‘hyperlink options’.

You can choose to view list data as hyperlinks
After you have set the URL (in this case the very same page) and the “Text to display” as something like {@Title} you can select the ‘Parameters’ button. This is the clever bit, you can simply force the filter parameters into the page url parameters by setting FilterValue1 as the value you want to filter by (for example {@Title} again), FilterField1 as the name of the column you want to filter, and the View to be the GUID of the webpart view in question. If you don’t know the GUID you can find it by filtering the view on the SharePoint page itself and looking in the URL, you should see the parameters exactly as we’re trying to send them. You’ll notice that the GUID is surrounded by curly braces {} when you enter these into the SharePoint designer DataView tool make sure you include them as control characters %7b and %7d otherwise it won’t work.

Editing the parameters of a hyperlink dataview
3. The amazing SharePoint designer “Error reading file” bug
Mmm. SharePoint Designer. Ever had the ‘Error reading file’ problem when trying to open an aspx page? I know I did, and despite Googling; never really found a satisfactory answer.
It seems that occasionally, for whatever reason, SharePoint designer may leave your aspx page with a horrendous amount of white-space which won’t appear in the code view. When loading the page back in, SharePoint designer will simply respond with the very informative error.
The solution is to export it locally as a file, edit it in your favourite robust text editor. Now you can’t simply remove the offending white space and import it back to the server, because it won’t reattach to the layout page, so create a new aspx page in the designer and, in the code view, copy and paste the text from the broken page into the new page. When you’re finished a bit of renaming should be all you need to switch this new page around with your broken page and hopefully it should load up in the designer tool again.
Tags: content Editor, data view, filtering, Sharepoint, tips
Posted in Sharepoint | 2 Comments »