Paging & Querystring Filtering RRS feed

  • Question

  • I have a page in Sharepoint with a DVWP that uses a querystring to do a lot of filtering.  All features work fine except for paging.  When I page to the next set it looks like doPostBack is called and my querystring is lost.

    What I think may be the solution is to somehow get '__redirect=mypage?querystring' into the paging link for the GenFireServerEvent.  I think somewhere in the concat if I could get __redirect then I could get paging with the next row number and my querystring to keep filtering in place.

    I cannot get the syntax correct.

    Is this even possible?  Here is the line that does the 'next' page.

    <a><xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$NextRow,'}'))" />;</xsl:attribute><img src="/_layouts/images/next.gif" border="0" alt="Next" /></a>
    Too bad there aren't session variables or I would store the filtering in session so that it would survive page changes and postbacks.  Currently all of my filtering variables are passed in the querystring orkept in the DOM for functions that happen in page.  All of this is lost on postback.

    Steve D.
    Thursday, December 17, 2009 2:21 PM

All replies

  • Hey Steve, couple of options:

    1. Try using hidden form variables
    2. Make static HTML links in your XSLT to do the paging
    3. Create a web part that grabs your querystring variables and puts them in session so you can use them in your DVWP
    Chris Givens CEO, Architecting Connected Systems Blog Twitter
    Friday, December 18, 2009 6:13 AM
  • Hi Chris,

    I have some questions.

    1.  How do hidden form variables work?  Is that where you just take an element and set its value and then style it as display:none?  If so don't these get lost when page is posted back?  I am currently using JQuery and setting variables in the DOM with .data (e.g. $("body").data('days', days);) bit I think on the postback the DOM is refreshed and all is lost.  I usually refresh these variables on page load fromt he querystring and use the QS to pass between page postings.

    2.  I may do this, it seems like it would be the easiest.

    3.  To create a web part are you talking about developing a web part in VS?  I have not tried that yet but I like the idea.  I am familiar with session vars from working in .Net but I have been scared away from doing web part dev in VS because the learning curve is so steep.

    I may also try setting up my own paging instead of using the built in.  Somewhere on this blog I know there is a posting about paging from a querystring with a whole paging template example but I cannot put my finger on it right now.  I have done it on a test page but never tried to fit it into a real page.

    Steve D.
    Friday, December 18, 2009 1:43 PM
  • Hi Steve,

    When I say hidden form variables I mean:

    <input type="hidden">

    Chris Givens CEO, Architecting Connected Systems Blog Twitter
    Friday, December 18, 2009 3:54 PM
  • I see, I have never used those before.  It seems simple enough but how do I get it to survive a postback?  Doesn't the value of the hidden input get lost?

    I apologize if these are noob questions.  I have not built many apps and most where in ASP.Net I could do this in Session variables.
    Steve D.
    Monday, December 21, 2009 12:04 PM