Question

I've built a web part for Sharepoint that retrieves data from an external service. I'd like to display the items in a way that's UI-compatible with Sharepoint (fits in with its surroundings.)

I'm aware of the "DataFormWebPart" but was unable to get one working properly. It requires a valid DataSource and I was unable to build one from the results of a web service call... Part of the problem is that my web service wrappers don't expose the XML return info, rather I have a bunch of deserialized objects. There doesn't seem to be an easy way to turn actual objects into a datasource, or populate a "generic" datasource from object data.

I could use an SPGridView to get the same UI, but the grid control doesn't have much in the way of smarts -and- it forces every field into its own column. I'd prefer to render each list item as a single cell with complex rendering (for instance the way that StackOverflow shows its lists of questions.) I'd also like to get as much of the Sharepoint-standard UI as possible, such as the sorting, filtering, and paging controls.

So, first: Has anyone here written a Sharepoint control that does this, and if so do you have sample code to share? If not: am I overlooking some useful control, whether MS-supplied or available in an external library?

Thanks! Steve

Was it helpful?

Solution

Sharepoint: Best way to display lists of non-Sharepoint content with “compatible” UI?

Take a look at the built in sharepoint web controls:

Microsoft.SharePoint.WebControls Namespace

It contains all the controls used in sharepoint. I'd tell you more, but the documentation is very thorough.

OTHER TIPS

Problem with SharePoint is that there are a bunch of different ways to do this. If your data is not changing too often and is not overly large it may be worth considering entering it into a list for display. If you have the Enterprise licence it may be worth getting your data into the BDC and using it there. you may have to convert the objects into xml or use the serialised objects with the XML webpart for display. This still has the issue of custom rendering using XSLT.

Here's a great article that explains how to configure BDC connections to web services using the BDC Definition Editor:

Creating a Web Service Connection by Using the Business Data Catalog Definition Editor http://msdn.microsoft.com/en-us/library/bb737887.aspx

The best way to do this IMO is to make a Web Part. As a Web Part the UI will be automatically rendered to be the same as the theme the site is using (unless you override it) and it will be able to be placed anywhere by anyone with admin privileges.

You could create a custom web part and use an SPGridView. You say you don't like it, because it forces every field into its own column, but that's not true. You can create a template (ITemplate) for every column and fully customize what's shown inside it, just like you would using a normal ASP.Net GridView. Using this approach I've added the little "New" images right next to a list item's Title, just like SharePoint does itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top