Quantcast
Channel: Degree Blog » Designer
Viewing all articles
Browse latest Browse all 3

Sharepoint Designer – Custom Item Style

$
0
0

So you’ve started messing around in Sharepoint Designer creating your own custom styles for some Content Query Web part (CQWP) by altering existing or adding new code to ItemStyle.xsl. You reach a point where you want to display a field that you don’t see in use anywhere else and you start wondering how to reference it. This tiny piece of code will actually print out a list of all the fields that are passed through and are available:

<xsl:template name="ListAllAvailableFields" match="Row[@Style='ListAllAvailableFields']" mode="itemstyle">
   <xsl:for-each select="@*">
       :: <xsl:value-of select="name()" /><br />
   </xsl:for-each>
</xsl:template>

(Ensure you check in ItemStyle.xsl so the changes are reflected in your solution)

Open your CQWP in Edit mode, expand Presentation and change Item Style (under Style) to ListAllAvailableFields. Click Apply and you should now have a list of available fields printed neatly (..!) out for each list item.

image

 

These are the internal column names, and you can now reference any of them like this:

<div class="fancyLook">
    <xsl:value-of select="@MyCustomField" />
</div>

PS: the double colon ( :: ) in front of each field name is just added as a divider. Obviously this is not part of the name.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images