Reusable Data View Webpart

Posted on August 3, 2009. Filed under: Data View Webparts | Tags: , , , |

Well if you ponder on how to re use a certain data view webpart across various sites, this would be the way to do. Use Lists.asmx as the ‘XML web services’ data Source for your data view webpart.

Let’s say the Organization Announcements are at the ‘Root Site A’, you want this webpart across SiteB & SiteC.


Brief Steps:

  1. Create a new aspx page in SiteB. Provide all the required master page references, styling and Insert a SharePoint web part zone.
  2. Now Insert a Data View and Click to select the Data Source.
  3. On the Data Source Library pane, Choose “XML Web Services” and Click ‘Connect to a web service’.
  4. Modify the Data Source Properties. Provide the appropriate Lists.asmx web service of the Root Site A. (http://xxxxxx/RootSiteA/_vti_bin/lists.asmx) and connect.
  5. Choose appropriate Command (Select), Operation (GetListItems) and Modify the ‘List Name’. Provide the List Name as ‘Announcements’ and Ok.
  6. A data Source is now created using Lists.asmx on Announcements from Root Site A.
  7. Now Select the option “Show Data” and Insert the selected Fields as “Multiple Item View”. Save the Page.
  8. Cool, now that you have the required webpart in your SiteB, lets reuse it in SiteC. Open the page from your browser and Edit the page.
  9. Select the edit properties of the data view webpart and click “Export” to save the ‘xxxx.webpart’ on your local file system.
  10. Upload this ‘xxx.webpart’ to the webparts gallery of SiteC and it will be available for you to add in on any page.

 Additional Customizations:

If you have any additional customizations via JavaScript or css on this data view webpart include these within the XSL style sheet by creating a new xsl template. This way when you export the webpart the respective customizations will be stored in the ‘xxxx.webpart’.


<xsl:text disable-output-escaping=”yes”>







<xsl:call-template name =”script”></xsl:call-template>


Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

2 Responses to “Reusable Data View Webpart”

RSS Feed for SharePoint Xperiments Comments RSS Feed

This is an informative and well written post! Any idea how one much create a reusable custom DispForm.aspx using this approach?

Thanks Steyn.
Alas I dont see a way to achieve this using the list form webpart in sharepoint designer. When you use a list form webpart it has to be associated with teh available lists in that site.
If you have option to use info path form and some managed code behind that, you can achive a common disp form for all the lists..

Where's The Comment Form?


    Xperiments n Xperiences. For the Last 5 years I have been providing variuos portal solutions (SharePoint focused) to my clients and now I intend to publish few of those solutions 'Not As It Is', which might help you. – Mash


    Subscribe Via RSS

    • Subscribe with Bloglines
    • Add your feed to Newsburst from CNET
    • Subscribe in Google Reader
    • Add to My Yahoo!
    • Subscribe in NewsGator Online
    • The latest comments to all posts in RSS


Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: