Wednesday, November 21, 2012

View Last Page in DVWP XSL

In Data View Web Part, for the user, It's not very comfortable to click again and again on the "Next" button till you've rich the end. So, Add “Last” to the paging in order to move to the last page of items.

The code to insert into the "dvt_navigation" template:

<xsl:variable name="FirstItemOfLastPage">

    <xsl:when test="$dvt_RowCount mod $RowLimit = 0">
      <xsl:value-of select="$dvt_RowCount - ($RowLimit - 1)"></xsl:value-of>
      <xsl:value-of select="$dvt_RowCount - ($dvt_RowCount mod $RowLimit) +1"></xsl:value-of>

<a class="LastPageLink">
  <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$FirstItemOfLastPage,'};dvt_startposition={}'))" />;</xsl:attribute>Last</a>

No comments:

Post a Comment