“Unable to Display this Web Part” Error in MOSS 2007
Posted by sapientcoder on November 14, 2008
If you’ve worked with SharePoint (MOSS) 2007 for any length of time, you’ve probably seen this error by now:
Unable to display this web part. To troubleshoot the problem, open this page…
I won’t bother typing out the rest of it because what it says, like most SharePoint error messages, isn’t incredibly helpful anyway.
There are many things that can cause this error (like doing a site restore with SharePoint Designer, etc.), but I’m writing about a specific circumstance I encountered today.
I had a case today where I saw this error on ALL web parts on a page simultaneously. Now, if they had all been web parts hooked into RSS feeds or web services or something, then maybe it wouldn’t have surprised me as much that they all failed at once (perhaps because of a network problem or something). However, these were web parts like a Summary Link Web Part and a couple of Content Query Web Parts.
Upon turning on debugging in Web.config, I discovered that the problem was my ItemStyle.xsl file (in the Style Library) that’s used by the Content Query Web Parts. An XSL template that I had copied-and-pasted from a blog into the file had a slight syntax error in it (it had “<br/>” as “</br>”).
So, the moral of the story is that syntax errors in your ItemStyle.xsl file can cause all web parts on a page to fail if any of the web parts are making use of that file. It would be nice if SharePoint would give a slightly better error message (like “Problems with the item styles used by this page prevent it from being displayed correctly” or something along those lines), but that’s not the case.