I'm looking to find a way to hide the whole Content Search webpart (including the webpart title and border area) if there are no results coming back from the query.
What I tried
There is this property: "ShouldHideControlWhenEmpty" but it doesn't do anything when there are no results. The webpart is still visible. Webpart has a the Title and the Border around it so when there are no results the title and the border show up with no results. Like I said I want to hide the whole thing in that case.
Wrote a jQuery script that searches for the text "There are no results" message (which comes from the webpart when there are no results) and hides the webpart. However, there is a short flicker once the page loads because the webpart first gets rendered for a split second and then disappears by virtue of my jQuery script - which is not great UI experience.
So I thought I could extend the OOTB ContentBySearchWebPart and get a hold of some kind property that would get me the result count. If the results count is 0 simply I would hide the webpart server side. I looked at the documentation online - nothing I could find that I could leverage. Help? Thanks!