Two SharePoint Designer DVWP Best Practices

I find myself retyping these two of my DVWP best practices over and over again in some form or another in the MSDN SharePoint – Design and Customization forum, so I thought I’d capture them here for posterity.

SharePoint Designer Generates Errors

It’s not unusual when you are making quite a few changes to a DVWP in SharePoint Designer that Designer itself causes errors.  Usually it’s one of the the dreaded "non-specific errors" which basically tells you that "you just did something wrong" (but nothing else useful).  The key trick here is to use Ctrl-Z to get back to the last working state.

Depending on the number and complexity of changes that you make, SharePoint Designer can "get lost".  It’s basically a code generator, and especially if you’ve made changes to the code yourself, Designer can cause errors.

When things like this happen, you’re often best served by simply editing the code yourself.  My rule is that if I have made a change to the code directly, I give up on using the dialogs altogether, as the odds of using them causing a problem is very high.

Web Part Connections Don’t Do What You Want

Web Parts linked with Web Part Connections, by default, tend to show all items; the filtering occurs once you’ve made a choice.  At least in the forum, almost no one wants this to be the case with their DVWPs.

What I usually do is build my own connections by passing values on the Query String back to the same page and filtering based on those values.  It’s more controllable, especially if the functionality of your DVWP is likely to expand (and when doesn’t it?),  and has the added benefit of allowing the user to bookmark what they are really seeing rather than the default starting point for the page.

Have a thought or opinion?