3

On my main landing page of SharePoint, I'm using a few CQWPs and the Blank Web Parts Page layout. One will show your upcoming tasks, one will show the projects you're a member or lead of, etc. I have most of the CQWPs in the Center Left zone. Center and Center Right zones are always populated with something. If a CQWP in the Center Left zone returns no results, the Center and Center Right zone are pushed below the Center Left zone, instead of sitting to the right of Center Left. Anyone know how I can keep the Center and Center Right zones in place even if the CQWP returns no results?

  • @RobertLindgren Actually it's an XSL issue. – user2536 May 21 '13 at 13:47
  • @RobertLindgren It should, yes. But css alone cannot fix it when the very HTML structure becomes broken along the way. – user2536 May 21 '13 at 13:50
  • True that! I have not seen exactly how it breaks the layout so there of my answer. Will clean my earlier comments. – Robert Lindgren May 21 '13 at 13:52
6

I'm guessing this is SP2013, as I myself have only encountered this in SP2013.

My personal explanation to this:

SharePoint 2013 Content By Query web part has a minor bug in its early releases. When returning no items it accidentally breaks the HTML structure of the page.

My solution:

Open the ContentQueryMain.xsl in SharePoint Designer. Find the XSL template OuterTemplate.Empty. As you can see it poorly handles the There exist no items situation.

Replace the template with this:

<xsl:template name="OuterTemplate.Empty">
  <xsl:param name="EditMode" />
  <xsl:choose>
    <xsl:when test="$EditMode = 'True' and string-length($cbq_errortext) = 0">
      <div class="wp-content description">
        <xsl:value-of disable-output-escaping="yes" select="$cbq_viewemptytext" />
      </div>
    </xsl:when>
    <xsl:otherwise>
      <div style="display:none">No content found</div>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

This way it renders something when there's nothing else to render and it does not break the HTML structure of the rest of the page.

I hope this solves your issue.

  • 1
    Yep, SP2013. That solved the issue. Thank you good sir! – Trenton M May 21 '13 at 14:02
  • @chanalevy You're welcome :) – user2536 Jul 9 '14 at 13:06
  • Is this problem solved in any service packs? – SharePoint Freak Jan 28 '15 at 14:10
  • @Richard Not that I'm aware of. – user2536 Jan 29 '15 at 7:50
  • Didn't work I'm afraid. – PeterX Nov 20 '15 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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