Question

How to display custom columns' values in Content Query WebPart? Currently I have a Custom List with 3 columns Title, MobileNo and Address. Content Query WebPart Only Displays First Column's value (Title), but I want to display all column's values on CQWP. How to do it? What are my options?

Était-ce utile?

La solution

1)Open ItemStyle.xsl

2)Add Template just like DisplayTemplate And give Proper Name(Currently given Name='MyFirst')

3)Add Variable After name="DisplayTitle"/> Currently i have two Columns MobileNo And Address

4)At The End of Code Add span

select="$MobileNo"

select="$Address"

5)Save ItemStyle.xsl and Checkin

6)Click on Edit WebPart ->Presentation->Fields to display: Here u can See Your Custom Column MobileNo & Address

Enter internal Name Of Column MobileNo inside MobileNo Custom Columns & Enter internal Name Of Column Address inside Address Custom Columns.

7)Click Ok

8)Done,now u can see all Custom Columns Data

u can see Total Code Below.(xsl:template name="MyFirst")

    <xsl:variable name="MobileNo"><xsl:value-of select="@MobileNo"></xsl:value-of></xsl:variable>
    <xsl:variable name="Address"><xsl:value-of select="@Address"></xsl:value-of></xsl:variable>

  <div class="item link-item">
    <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
    <a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
      <xsl:if test="$ItemsHaveStreams = 'True'">
        <xsl:attribute name="onclick">
          <xsl:value-of select="@OnClickForWebRendering"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'">
        <xsl:attribute name="onclick">
          <xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:value-of select="$DisplayTitle"/>
    </a> - <span><xsl:value-of select="$MobileNo"></xsl:value-of></span>
    <span><xsl:value-of select="$Address"></xsl:value-of></span>

  </div>
</xsl:template>
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top