Making the DVWP (DataView/XSLT WebPart) reusable in any site collection


  1. Before exporting the data view webpart add an additional parameter using SharePoint designer parameter ribbon option, the final code for the parameter should look like the following: <WebPartPages:DataFormParameter Name="WebURL" ParameterKey="WebURL" PropertyName="ParameterValues" DefaultValue="/sites/toplvlsite/"/>
  2. Once a dataview webpart is created using SharePoint designer, perform an export using [WEB PART]\To File.
  3. Open the exported webpart file content in NotePad++
  4. Search for a line  <property name="ListName" type="string" and remove it. E.G: <property name="ListName" type="string">{2AA6099D-238B-4692-8BB4-48EFFB0952B1}</property>
  5. Remove the following elements and their content out of the file as we are only using the dataview to display content:
  6. <UpdateParameters>[Any Content]</UpdateParameters>
    <InsertParameters>[Any Content]</InsertParameters>
    <DeleteParameters>[Any Content]</DeleteParameters>

  7. Before doing the next step, replace the GUID assigned to the ListID parameter with ListName value (Get from List Settings > Name value) – Look for GUID with parenthesis as well { and }.
  8. Replace all occurrence of "ListID" to "ListName" and replace the defaultValue with the Name of the list.
  9. The following entry needs to be adjusted as well for string entry : <property name="ListName" type="System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">Issues</property>