Archive for the ‘Field’ Category

CQWP (Content Query Web Part) Display all fields + values

October 30, 2009 2 comments

Moved from old blogging site

Below is the code which I use frequently for my XSL development in CQWP. This xsl code gets all the data and values, this helps you identify all the data before you move on with visual html development. Initially I used this custom xslt to display all the field names in Content Query Web part. I modified it to see values along with field name. Its simple needs no explanation.

<xsl:template name="AllFields" match="Row[@Style='AllFields']" mode="itemstyle">
 <xsl:param name="CurPos"/>
 <xsl:variable name="SafeLinkUrl">
 <xsl:call-template name="OuterTemplate.GetSafeLink">
 <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
 <xsl:variable name="SafeImageUrl">
 <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
 <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
 <xsl:variable name="DisplayTitle">
 <xsl:call-template name="OuterTemplate.GetTitle">
 <xsl:with-param name="Title" select="@Title"/>
 <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
 <xsl:variable name="LinkTarget">
 <xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>
 <div id="linkitem" class="item">
 <xsl:for-each select="@*">
 <span style ="font:bold">    <xsl:value-of select="name()" /> </span>  : <xsl:value-of select="."/> <br/>



Categories: Content Query, Field, SharePoint, XSL, XSL Tags: ,

Fix "Render Failed" Error on Groupby View using Jquery

March 10, 2009 11 comments

I recently encountered this error “&lt;!– #RENDER FAILED –&gt”.


I found the cause for it after searching and browsing various posts and comments about this error.


Well it is a bug and hasnt been fixed anyway the below are the steps/combinations that cause it.

  1. Calculated Field from another list is being used as Lookup Column value in your list.
  2.  Group By the Look Up field (linked to Calculated Field in other List)
  3. Group Setting: Collapsed.

Solution: Apparently from the forums I visited turning Collapsed to Expanded in group setting fixes it and it does. Woo Hoo!.

But the problem is Collapsed setting is used to save real estate and this fix defeats that purpose.


Fixing with Group settings Collapsed

I had read about this Collapsing all Groups feature post at end user SharePoint  by Paul Grenier using Jquery and that seemed like a perfect candidate for this.  In This solution we shall turn Group setting to Expanded and use JavaScript to collapse on load.

  1. Set the Group Setting to Expanded ( this will fix the error)
  2. Use the collapse all code Paul Grenier provides fire it during load.
    1. Add  Content Editor to the Page
    2. Click Edit Web Part and Add the Code below to Source Editor section of the Web Part and in Appearance Section select frame type as “None”.
<script src="" type= "text/javascript">

<script type="text/javascript">
function collapseGroups() {




3. This will Collapse your Expanded Groups.



Issues with this method: I think in regular Group “Expand Collapse” SharePoint remembers your last collapse or group by setting. This script will ignores all that and collapses everything on Page Load

Now there are other ways to accomplish this.

  • Event handler instead of Calculated column to do the calculations and storing value in the field and use that field as look up.
  • JavaScript on Edit and New Form page, by adding  a new field and using Scripts to hide the field and populating them with calculated value (calculation done in the script). Click here to learn more