Partilhar via


Showing the total number of items when a view is paged

This little tip just went through my inbox at work. If you have a DVWP and you want to make it page (so you show only 6 items at a time, for example), by default FrontPage does not add the Total number of items to display.

In order to show the total, you just need to add a small piece of XSLT to the Data View.

1. Insert your data view web part
2. Click on Data..Style..Options
3. Put a bullet in there to Show in set of this size: 6)..click OK
4. In Code view, find:
<td nowrap="true" class="ms-vb">(Items<xsl:text xmlns:ddwrt="https://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$FirstRow"/><xsl:text xmlns:ddwrt="https://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;</xsl:text>to<xsl:text xmlns:ddwrt="https://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;</xsl:text><xsl:value-of select="$LastRowValue"/>)</td>

(which is the rather intimidating way that we write the Items and their count)

5. Add the following just before the closing </td> tag:
of <xsl:value-of select="$RowCount"/>

7. Save the page

I posted this under the How To section here as an article as well.

Enjoy!
-John