Your First Data View Web Part

Note: using the Data View Web Part in SharePoint 2007 requires SharePoint Designer (SPD), the Microsoft Web editor successor of FrontPage.

Introduction

The Data View Web Part (DVWP) allows you to modify the look and feel of displayed data. The data is usually pulled from a SharePoint document library or list, or from an XML source (XML file, RSS, Web Service, etc.).

Of all the SharePoint tools made available to end users, the DVWP is certainly the most powerful. It will allow you to:
• Display a SharePoint library or list in another site
• Aggregate data from multiple sources
• Display highly customized views
• Apply conditional formatting to your data
• Display data driven charts (combined with a Flash or Silverlight charting tool for example)
• Apply advanced formatting beyond what the SharePoint UI offers (e.g. open link in new window)
• Create cross-row formulas
• Etc.

A warning before you start

Be aware that using SPD gives you access to the whole content of your page. You run the risk of accidentally deleting a default control, which will break your page. I recommend not using SPD on your site default pages (default.aspx for example). Instead, create a separate Web Part page (Site actions > Create > Web Part page).

Tutorials

As I did for the Content Editor Web Part (CEWP), I’ll just point to the best posts I have found on the Web.

The terminology can be confusing, as “Data View Web Part” and “Data Form Web Part” are used interchangeably. In SPD itself for example, you use the “Create Data View” menu, but once on the page the Web Part is called “Data Form Web Part” (more details here).

In SharePoint Designer, there are two ways to create your DVWP:
1/ by converting a SharePoint library or list. This is the easiest way. Ishai Sagi provides a very detailed tutorial here:
Creating an XSLT DataView for a sharepoint list
Note in particular the export/import tip at the end of the article.

2/ through the menu: Data View > Insert Data View. This is a more general method.
Also a good tutorial here by Raymond Mitchell (with the promise of more to come):
Getting to know the Data Form Web Part (1 of 4)

Looking for more information?

You’ll find lots of articles about the DVWP. For example, this article from Matt Smith lists several interesting links:
Data View/Form Web Part to the Rescue!

Search the Web with those keywords: “Data View Web Part”, “DVWP”,  “silver bullet”, “Swiss army knife” (No kidding!). Note that a DVWP was already available in SharePoint 2003, some articles written for SP 2003 do not apply to SP 2007.

I’ll show some applications of the DVWP in future posts. Sometimes we have the choice between the DVWP and the CEWP, in such case I usually favor the CEWP as it is a safer approach. Changes can easily be undone by simply deleting the CEWP. And, of course, the CEWP will be your only choice if you don’t have SharePoint Designer.

Advertisements

15 thoughts on “Your First Data View Web Part

  1. Pingback: SharePoint’s Swiss Army Knife – Now for free! « Path to SharePoint

  2. Pingback: The Content Query Web Part « Path to SharePoint

  3. I have been trying to use the fun dvwp styling – that you can do in SPD – but I have been consistently running into 2 roadblocks

    1. First I try using the UI to filter

    If I insert the list view webpart onto my page – and then filter it and get it close to how I want it to look (grouped etc…) then go into SPD and “convert to xslt” I get the following error

    “The server returned an non-specific error when trying to get data from the datasource.
    Check the format and content of your query and try again.
    If the problem persists, contact the server administrator”

    2. Then I try creating the DVWP in SPD

    I create a DVWP straight on the page – without using the ui – style it like I want it, and then go to the rendered page and export it – then try to import it back onto the page I want it on…
    I get the

    System.ArgumentException: The specified view is invalid.

    Any tips on how to debug-troubleshoot what it is that is breaking the thing?

    3. And further – once I have the webpart – does anyone know how to alter the code – so I can switch which list it looks at? (in case I want to use it in another site with the same type of list)

  4. Pingback: HTML calculated column and Data View Web Part « Path to SharePoint

  5. ugh….had to read between the lines on this one. Not very straightforward, and too high level. Not for developers really, who want to know the hows and whys.

    • That is correct, this blog targets end users. Some other posts are more detailed and include code (XSLT, JavaScript/jQuery), but don’t go deep into technical considerations either.

    • Good work!Does SharePoint 2013 has some web part to show a oneNote notebook in a Frame ?So that we can edit a Note while still senieg the quick menu, header and other webparts?Thanks,Gael

  6. Hello,

    I am hoping you may be able to lead me in the right direction. First Off: I am a novice developer working with a Sharepoint list of data. In this data I have multiple columns that contain conditional YES/NO values. I have been trying to figure out a method to convert the YES/NO to Green/Red graphic.

    Conditionally if yes = green, if no = Red.

    I have been confused in how to implement the above. I had found your columns on “calculated columns” as well as the “apply color”, lastly this column. I understand the columns conceptually but have been recking my brain on the implementation piece.

    I have been using sharepoint designer to create some simplistic workflows thus far and thought that I could create the conditional statment above (easy part). the problem was the action of changing the color of the cell based on the condition.

    sorry for the rambling, I just thought you may be able to direct me to the path of completing this task.

    Thanks,
    S

  7. Pingback: Bridging the gap between the users and IT « Path to SharePoint

  8. I have read so many posts regarding the blogger lovers however this piece of writing is iin fact a
    good paragraph, keeep it up.

  9. s also the manufacturer of the world-famous Regza line of LCD television
    sets. The written language came from China and the Buddhist religion from Korea.
    No stranger to controversy, Lady Gaga is encountering a media storm over her latest single, “Alejandro.

Comments are closed.