We are customizing a Community site. On each category page we have a Discussion List webpart in "Featured Discussions" view. It works great if the category has a featured discussion. But if it doesn't it puts a big grey box saying

There are no items to show in this view of the "Discussions List" list.

We don't want to see that.

I found this tutorial shows how to change the message. Unfortunately the tutorial just leave deciding when there are no items up to the webpart.

But we would rather just hide the whole webpart if there is nothing to show. Any ideas on this?

1 Answer 1


Using jquery would be fine, but just flip the approach. Instead of hiding the webpart if its empty , make the webpart hidden by default, and visible only when content is available.

Here is the approach.

  • Add a Content Editor / Script Editor webpart with CSS code that hides(remember just mark display none / visible false, dont remove) the Discussion List webpart by default.
  • Place the styling code above the Content search webpart to ensure when the page loads the Content search Webpart is not visible.
  • During pageload check if the Content search webpart contains result , if the webpart contains result , then make the webpart visible. Here you will search for the text "There are no results" message, if its present you do nothing , else you make the webpart visible
  • Awesome, thanks. Great trick and it worked. I'll have to think about things like that in the future!
    – Rothrock
    Commented Feb 17, 2015 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.