As most of us know that if you create a site out of a custom site template with DataView Web Part on it, the DataView Web Part pages of this site are not going to display properly.
The Error presented in the browser will be like this:
“Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.”
When SP creates the site, it recreates lists, thus assigning a brand new GUID to it.
Sure enough if you open the page in SharePoint designer you will see that the DataVIew Web Part has lost it’s data source because it still refers to the original list’s GUID that it was bound to. But there is a way to avoid this.
And, no, I’m not going to take all the credits for this tip, as it was generously given to me by my colleague, Jonathan Bradshaw (Thank you J).
You can preserve the DataView Web Part data source by binding it not to the GUID of your list but to the List Name instead:
• Open the web part definition in your editor of choice
• Look for all occurrences of ListID in the web part definition and right next to that you should see a GUID.
• Replace ListID with ListName and the GUID with the list name you want to bind to.
It’s that easy.