Wednesday, August 8, 2012

DataView Asynchronous Paging issue

I faced problem when tried to use paging with DataView. Because DataView use history.back(); for previous link. It doesn't work correct.
I found  blog solved this problem:
http://geekswithblogs.net/haniamr/archive/2011/05/31/paging-problem-in-data-form-webpart-sp2010.aspx

Open the code view and search for a that has a class named “ms-paging” and then paste those lines before the starting of the td tag:

<xsl:variable name="dvt_PrevPageData">
<xsl:choose>
<xsl:when test="($FirstRow - $RowLimit - 1) > -1">
<xsl:value-of select="$FirstRow - $RowLimit - 1" />
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>

Search for “history.back()” and then replace the line with that line:
<xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$PrevRow,'};dvt_startposition={Paged=TRUE&p_ID=',$dvt_PrevPageData,'}'))" />;</xsl:attribute>

To make sure this solution work correct RowLimit must equal pagesize