I'm always trying to educate developers on the Data Form web part (DFWP). If there was a Visual Studio add-in to configure the DFWP I think there would be a much greater uptake in using the web part in custom SharePoint solutions because developers seem to think that using SharePoint Designer (SPD) is not real development.
The number of times I've seen developers spending days on a web part that uses SPGridView which I could have built in 5 minutes...
Upon this revelation, developers often say to me, ah – but I need to display some images in place of the data values and provide column sorting. Of course the DFWP does all of this and more.
The final objection is that the DFWP requires knowledge of XSL. This is where SharePoint designer comes into its own with automatic xsl generation and dynamic linking between design and code view for the data elements.
Some of the benefits of the DFWP:
- It is based on XSL – so you have separation of the presentation from the data and can do all the conditional formatting you want.
- You can update the web part on a production server without console access.
- It supports lots of data sources (SharePoint data sources, data base connections, Web Services, xml files, server scripts (rss feeds etc).
- You can convert an existing List View into a DFWP.
A few tips when using the DFWP:
- When using a SharePoint list/library data source, change from ListID to ListName (using SPD code view). This lets you use the .webpart definition in a site template.
- After completing the xsl design for the DFWP in SPD, copy it into the Style Library (already exists in a MOSS publishing site collection, otherwise create one yourself) then all instances of the DFWP can be updated from a central location.
- Database connections can't use integrated security. If you have MOSS, use SSO.
The only time I have to concede is for administration pages in the Layouts folder where you don't appear to be able to use web parts at all.
So developers, please consider the DFWP the next time you want to build a data bound web part. Check out John Jansen's videos on getting the most out of SharePoint Designer 2007.