How To Display Custom Columns Data On Publishing Page Using Content Query WebPart? [duplicate]

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/134689

Pergunta

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?

Foi útil?

Solução

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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top