PageCountChanged event?

2 posts, 0 answers
  1. Bent
    Bent avatar
    38 posts
    Member since:
    Sep 2008

    Posted 18 Nov 2008 Link to this post

    Hi there

    Whenever I modify the query with my RadGrid, I might get into a situation where the current page the user is viewing is no longer there (ie. page 15 out of 10).

    I currently perform a check in the RadGrid's PreRender event, to see it the actual PageIndex+1 is higher that the PageCount, in which case I set the new PageIndex to 0 (or PageCount-1 depending on what I am trying to achieve). This however seems a bit like a hack, and I would appreciate some other, more elegant solution.

    The first thing that popped into my mind was a PageCountChanged event perhaps? We already have PageIndexChanged and PageSizeChanged, but not PageCountChanged.

    Any ideas/solutions?

    EDIT: Whoops... I just found out that my own "solution" didn't even work as I expected. A correct solution would now be _very_ much appreciated! :)
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 21 Nov 2008 Link to this post

    Hi Kenneth,

    Generally, the page index should be reset when you change the page size of the grid. This can be verified on the following online demo of the grid:

    http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Programming/Slider/DefaultCS.aspx

    (change the pager mode to 'Advanced' or 'NextPrevNumericAndAdvanced' havigatio to a different page and set page size greater than 100 for example)

    Alternatively, if you change the page size manually, simply set the CurrentPageIndex of the grid to 0 and rebind the control invoking its Rebind() method to attain the same effect.

    Best regards,

    Stephen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top