1,685 articles and 12,533 comments as of Thursday, September 2nd, 2010

Thursday, March 4, 2010

Data View Web Part Q&A

Laura Rogers, SharePoint 911This question arrived this morning from Robert:

“Session 1 of your DVWP Series sounds like it might solve a problem we have. Namely, we need some way to display an aggregate list of all (printable) form documents at the top site level that includes in that list all (printable) form documents stored in document libraries of various subsites.

Question: How far would Session 1 address this need we have?”

Hi Robert,

There may be a couple of ways to accomplish what you need in your scenario, but the “List Relationships” is not one of them, unfortunately.

Here’s a blog post I’ve written about how to do a “roll up” web part. Unfortunately, I haven’t ever been successful in working with document libraries with the roll up. I can get it to list all the documents, but haven’t been able to create the hyperlink to open each one.

Also, there’s a way you could create a linked source to merge multiple document libraries, but this wouldn’t be automatic, and you’d have to modify the data view web part each time a document library was added. Here’s a screencast that I’ve done on that concept:

http://www.endusersharepoint.com/2009/07/08/3-minute-screencast-merging-sharepoint-document-libraries/

Thanks for the inquiry!

 

Please Join the Discussion

6 Responses to “Data View Web Part Q&A”
  1. Nick Hadlee says:

    The following should work for generating a link to a document in a DVWP roll up for document libraries:

    <a href=”{concat(’/',substring-after(@FileRef,’;#’))}” title=”{substring-after(@FileLeafRef,’;#’)}”>
    <xsl:choose>
    <xsl:when test=”string-length(@Title) = 0″>
    <xsl:value-of select=”substring-after(@FileLeafRef,’;#’)” />
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select=”@Title” />
    </xsl:otherwise>
    </xsl:choose>
    </a>
    
  2. Charles says:

    Hi,

    You wrote a lot on DVWP. It’s true that it’s an intersting functionnality to use.
    Is it possible to package a customization inside a solution file ?

    It’s the missing piece to really use DVWP.

    Thanks,
    Charles

  3. Laura says:

    Hmmm, not sure, I’ll see if I can get a developer to answer that one, since I’m not one.

  4. I agree with Charles … The Sharepoint projects I’m working on are all code based using Visual Studio and packaged as solutions … My 1st idea would be to deploy the VS solution to a dev server, open the dev version in Sharepoint Designer & apply DVWP techniques taught here, Export the customized DVWP to your local file system (They will still be associated to the GUID that you’ve created for your solution’s lists) & then copy them to your VS project.

    Is this the best or most common way? Interested in suggestions.

  5. Nick Hadlee says:

    The best way I have found to do this is first to remove any hard coded ListId’s from from the DVWP and replace with ListName. (See Marc’s post for more info on this). This will make them more reusable…

    Next export the DVWP off the page (Wictor has a post on this) which will give you a .webpart file.

    Lastly add this to your Visual Studio project (sorry aboutt the code talk Mark) and deploy it to the Web Part gallery using a feature. (MSDN example here). Something like this will work:

    <Module Name=”WebParts” List=”113″ Url=”_catalogs/wp” Path=”WebParts” RootWebOnly=”True”>
    <File Url=”Exported_DVWP.webpart” Type=”GhostableInLibrary”>
    <Property Name=”Group” Value=”Exported DVWP” />
    </File>
    </Module>


Notify me of comments to this article:


Speak and you will be heard.

We check comments hourly.
If you want a pic to show with your comment, go get a gravatar!