SharePoint Designer Error When Saving a Page with Multiple Data View Web Parts
I could probably write an entire book on the strange things that SharePoint Designer does, but I don’t have time for that. Instead, it’s yet another blog post.
Today I was adding some Data View Web Parts (DWVPs) to a page, and I took the shortcut of copying and pasting the code of one to create another in the same page. This always works, but there are some things you have to do to pull it off.
When I went to save the page, I got this rather cryptic error:
Server error: The URL Pages/Employee Handbook.aspx is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.
Now, obviously the page existed, as it was the one I was editing, and the path was right, because it was the original location.
After thinking about it for a few minutes, I realized that I had forgotten to change the GUID in the copy of the original DVWP. I had two DVWPs in the same page with the same GUID, which is a no-no. Of course, the error is totally confusing and doesn’t indicate the actual problem.
If you copy and paste a DVWP’s code to create a new one, you have to change [at least] two attributes in either the original or the copy. Both the ID and the __WebPartId must be unique. They will look something like this:
ID=”g_ff043ef3_b944_4912_b32d_6ff419e69761″
__WebPartId=”{476FBB3B-91DD-4FDA-A20C-7FB1DA457B09}”
I admit that I always cheat on this and simply change the last character of the two GUIDs. I know I’m supposed to use some GUID generator, but the only place that these two GUID must be unique is within the current page.
That is an excellent tip. Thanks again Marc for sharing your helpful insights.
Your diagnosis is consistent with what I observed Monday. I feared I would have to rebuild the page, until I noticed in SPD that somehow, the XSLT for three web parts had been duplicated in the page. Possibly accidental copy/paste on my part, or possibly server issues led to corruption–SQL was taking 9GB of memory.
great Tip thanks!
Marc to the rescue again!
excelent!!! great tip
Great tip. Thanks a lot.
Thanks a lot.
Thanks Marc. It was very helpful tip.
Thanks Sir… I was ready to curse SharePoint Designer and I completely forgot about unique WebPart ID requirements