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

1 comment:

Vikas G Reddy said...

Thanks fro the solution.
I got a problem that, the paging is working fine for previous but the data is not showing with respect to the paging. It is showing 1st page data when I am in 2nd page, this is occurring when using your code for previous button.