Custom Lists, Data View Web Parts (DVWPs), Search, and RSS

Have I ever mentioned that I’m a big fan of Data View Web Parts (DVWPs)?  Well, yes I am.  I find them indispensable to display the contents of lists in a nice, clean format rather than staying with the out-of-the-box views that the list provides.

One issue with this is that Search and RSS want to show you the list item itself, not the nice, formatted page that you’ve build up with branding, other Web Parts, specialized navigation, etc.

I recently though of a nice way around this.  I have sites where I am displaying lists of items from specific lists.  On these sites, eventually the user clicks on an item’s title, and I want to show that one list item in my nicely formatted page by passing the item’s ID in a query string.  Usually, I would create that page in the current site.  However, in this case, I copied the list’s default DispForm.aspx (call it DispForm2.aspx) and added all of my DVWPs, branding, custom navigation, and other Web Parts to it.

To do this, open DispForm.aspx in SharePoint Designer and delete the existing ListFormWebPart.  Insert whatever DVWPS, etc. that you want on the page and save it.  Then right click on the list itself, and choose Properties.  On the supporting files tab, change the Display item form to point to your new aspx page.  Make sure that you choose Item (or your Custom Content Type) from the dropdown above, or your change won’t "take".  Click OK.

Now, my nice page is the one that is linked to from other sites, and when Search or RSS show a hit on a term in the item, rather than the default DispForm.aspx, my nice DispForm2.aspx is displayed instead.

One odd thing to note: When you hover over the link to the item in Search or RSS, you’ll still see DispForm.aspx as the destination.  Don’t fret; it gets resolved correctly to DispForm2.aspx when you actually click on the link.

Have a thought or opinion?