Data View Web Part

Posted by on Mar 1, 2009 in SharePoint, SharePoint 2007

I have been doing a lot of work lately with SharePoint 2007 and came across 2 scenarios where I needed to utilise the Data View Web Part (DVWP) available from within SharePoint Designer (SPD). I honestly think that this is one of the many under utilised tools from within SharePoint.

Scenario 1
The request was to be able to display a subset of an existing SharePoint list from one sub site and display it on another sub site.
Scenario 2
The request was to be able to have items within a list highlighted (different colour for instance) based on a condition, a.k.a conditional formatting.
In both of these scenarios I was able to utilise the DVWP to tackle these two requests quite easily. Firstly we need to launch SPD as this is where all the action occurs. We then need to checkout the page where you would like to insert the DVWP. After the page is checked out for editing, we add the DVWP by selecting Insert from the toolbar menu within SPD and then selecting SharePoint Controls / Data View.

The Data Source Library appears on the right providing us with the ability to select a SharePoint List from the current site or you could connect to another library from other sites in the site collection.

Data Source Library

Click on the required list and then select Show Data. Finally click on Insert Selected Fields as and then select Multiple item view. As you can see from the Common Data View Tasks you can easily create filters, sort, add or remove columns and in my case I was also able to apply Conditional Formatting.