For those who want to hide Content Query Web Part when empty, in other words, when it returns not data, this post is for you! The solution won’t require you to dive into XSL world, it’s pure JavaScript. Basically you will drop the code code snippet to your pages and everything will work.

The Content Query Web Part (CQWP) is a great way to query data from other sites and present it inside one page. Content Query Web Part can be used with their default layouts or you can create some if want.

According to a Code Project article: ” This web part is rather nifty and it has many cool features. With the CQWP, you can now control how the content is displayed. We can use html tables to format the display however we wish. This article explains how to customize the CQWP using SharePoint 2010 without any code and deployment. “.

The Content Query Web Part - Hide Content Query Web Part when empty
The Content Query Web Part

Unfortunatelly, this post may be a little bit outdated because Microsoft reinforces that Content Search Web Part is a better option now. You can check this post when to use the Content Query Web Part or the Content Search Web Part in SharePoint.

Continue reading