Reusable Data View Webpart
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.
- Create a new aspx page in SiteB. Provide all the required master page references, styling and Insert a SharePoint web part zone.
- Now Insert a Data View and Click to select the Data Source.
- On the Data Source Library pane, Choose “XML Web Services” and Click ‘Connect to a web service’.
- 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.
- Choose appropriate Command (Select), Operation (GetListItems) and Modify the ‘List Name’. Provide the List Name as ‘Announcements’ and Ok.
- A data Source is now created using Lists.asmx on Announcements from Root Site A.
- Now Select the option “Show Data” and Insert the selected Fields as “Multiple Item View”. Save the Page.
- 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.
- Select the edit properties of the data view webpart and click “Export” to save the ‘xxxx.webpart’ on your local file system.
- Upload this ‘xxx.webpart’ to the webparts gallery of SiteC and it will be available for you to add in on any page.
<xsl:call-template name =”script”></xsl:call-template>