Silverlight instead of DataView Web-Parts? Sure, why not?

I have been customizing dataview web-parts for years-for SharePoint they are extremely handy for displaying list data and given you can convert to XSLT view and hack away at the XSLT they definitely provide a level of customization out-of-the-box especially using SharePoint Designer, aggregated datasources, etc.  Even developed a content rating and commenting system all just using dataview web-parts, customized XSLT and linked datasources.  Check out previous post last year Implementing Content Ratings for Sharepoint via site template Part 1  and Part II step-by-step for just on example. 

But there is a darkside to the trusty DVWP…the list ids are hard-coded into the datasource provider which reduces the portability from one site page to another.  You can mitigate somewhat by swapping out the listids for listnames but that could create conflicts since you have two lists with the same name in SharePoint (hence the listid).  You can also centralize the XSLT by storing as a file and then referencing from the dataview web-part settings in SP Designer but still no matter how you look at it things always get messy.  I am convinced this is one of the main roadblocks to making it easy for site editors to make the content dispersed throughout the SharePoint more discoverable.  Blogs are a great example-have you ever tried to develop a customized view of a SharePoint blog or post and host on another page?  How about another page in another site collection?  It’s possible but a ton of work for something that should be easy. 

Recently I have ditched the DVWP in favor using Silverlight to consume/display list data where consuming list data in a customized user-experience is required.  Developed a generic Silverlight web-part that users can configure via the web-part properties pane easy enough.  Plus can be exported/imported from site pages and uploaded into the web part gallery for everyone’s use.  Do that with a customized dataview web-part. 

Advantages of this approach:

  • Can be added to any site page on any site collection easily by the user without a developer or SharePoint Designer involved.
  • Can be easily deployed on our customer’s SharePoint sites and do not require a substantial effort to migrate to new hardware.
  • A more rich UI is possible using Silverlight and development is simplified using Visual Studio and C#.
  • The project files (.xap) developed in Silverlight are stored in standard SharePoint libraries and can be updated without the need for IT to be involved.


I can hear the comments coming…what if I can’t deploy "real" webparts since I don’t have administrative rights on the server or our customers SharePoint environment is locked-down?  I feel your pain, been there, done that.  Here is the answer-drop your Silverlight application .xap file into a SharePoint document library along with the html test page and simply reference via an inframe in another famous web-part the Content Editor Web-Part.  Another web-part with it’s own set of pros/cons for sure but handy in this case for displaying your Silverlight application on a site page without having to develop/install custom web-parts.

Recently posted several examples of how to pull SharePoint list data into Silverlight in variety of ways and even the source code so check it out-one more tool to add to your SharePoint arsenal. 



Use SharePoint and Silverlight to display a summary of SharePoint blog posts on any site page


We have been investigating ways on our intranet at Allyis to surface information via a more automatic and less manual process through various features and also to Implement multiple ways for discovering data/information across the site.  One area in particular we have been looking for improvement has been to increase the discoverability of our leadership blogs and encourage employees throughout our organization to blog as as way to increase collaboration and information sharing. 

As a way to address these efforts we recently developed and deployed a suite of web-parts (one of which we call the BlogRollUp web-part) which displays details on the most recent post made to any of our SharePoint blogs.  The web-part can be added to any site page, configured to point to a specific blog, and uploaded into the web-part gallery for others to use as well. 


Screenshot (Single Post Version): Screenshot (Multi-Post Version)


  • Displays blog title as a hyperlink to the original full post.
  • Displays the first 215 characters of the post body as an excerpt.
  • Displays an image for the blogger or blog.
  • Displays the post’s category as a hyperlink to view all similiar posts.
  • Displays the number of comments as a hyperlink to the comments page.
  • Displays an alert icon hyperlinked to the blog’s alert page.
  • Highlights background on mouseover.
  • Users can configure the web-part settings. 


Technical Approach:

  • The user-interface was designed and developed entirely using Microsoft Expression Blend, Silverlight, and Visual Studio 2008. 
  • Custom SharePoint web-part to host the Silverlight application which allow users to configure which blog, blogger image, and alerts link from the web-part properties pane directly. 
  • The Silverlight application code uses the initParams provided from the webpart or HTML test page and the URL protocol to access the blog’s post list directly.
  • The web-part can be configured once and easily exported from and imported to the webpart gallery and added to any site page on any site collection.  
  • The Silverlight application was deployed into a SharePoint document library for ease of future updates. 

Advantages of using Silverlight:
Rich support for animation, rich set of controls, good development tools, i.e. Microsoft Expression Blend and Visual Studio 2008, and all the advantages of coding in C# with a simple deployment process. You can even copy the Silverlight XAP files (essentially a compressed zip file with all your code) into a SharePoint document library and run from there along with a simple HTML page.

Deployment Methods

Deployment using only a document library and a content editor web-part without the need to install server-side code and as such administrative access typically not required.

  1. Download the Visual Studio solution .zip and extract the files.
  2. Download

  3. Create a folder named ClientBin in a SharePoint document library to store the Silverlight application. 
  4. Locate the BlogRollUp_Web\ClientBin\BlogRollUp.xap file and copy into your new ClientBin folder
  5. Locate the BlogRollUpTestPage.html, update the initParams to use the settings for your particular blog including siteurl, imagepath, listid, and alerturl. 
  6. Copy the updated BlogRollUpTestPage.html file to the root of your new document library.
  7. On a site page add a content editor web-part and reference the BlogRollUpTestPage.html file inside an iframe. 
  8. Export the now pre-configured web-part to your desktop and upload back into the webpart gallery with an appropriate name identifying the BlogRollUp webpart so other users can add to their site pages without having to configure themselves. 

Deployment using the custom web-part where server-side code is installed via the .wsp solution file for the webpart and typically requiring administrative access

  1. Download the Visual Studio solution .zip and extract the files.
  2. Download

  3. Create a folder named ClientBin in a SharePoint document library to store the Silverlight application. 
  4. Locate the BlogRollUp_Web\ClientBin\BlogRollUp.xap file and copy into your new ClientBin folder.
  5. Download the .wsp solution file
  6. DownLoad

  7. Install the provided .wsp solution file via stsadm -addsolution
  8. Activate the solution from SharePoint Central Administration or stsadm -activatefeature
  9. Upload the provided webpart .dwp file into your web-part gallery via site setting, web parts. 
  10. Add the web-part to a site page, update the Silverlight web-part settings section with the appropriate .XAP fullpath, siteurl, imagepath, listid, and alerturl for your particular blog
  11. Export the now pre-configured web-part to your desktop and upload back into the webpart gallery with an appropriate name identifying the blogrollup webpart so other users can add to thier site pages without having to configure themselves. 


This is just one way of displaying some pertinent details on recent posts from the blogs dispersed throughout the intranet while also making it easy for users to add to any site page.  Using Silverlight allows .NET developers to develop rich UI in Expression and Visual Studio and store the .xap files in SharePoint document libraries for future updates.