RadGrid and paging reset

8 posts, 1 answers
  1. B.
    B. avatar
    5 posts
    Member since:
    Apr 2009

    Posted 15 Mar 2010 Link to this post


    Inside an UpdatePanel, I have a "search" button and a RadGrid. The grid is programatically data-bound whenever the search button is clicked. I also have a RadAjaxManager which enables the paging (otherwise, "next" and "back" always return the first set of results). The problem is, if I select say the second page of a set of results, then click "search" to create a different set of results, the grid shows the correct results but the paging is still on page 2, and I'd like it to start on page 1.

    I have tried to reset the paging index to 1 on my search button onclick, to no avail. I cannot set it on the databind bit, since that is called whenever a new page is selected.

    Any help appreciated.

  2. Answer
    Tsvetoslav avatar
    1823 posts

    Posted 16 Mar 2010 Link to this post


    You need to reset the page index to 0 and call the grid's Rebind() method.

    Best wishes,
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Chris McGrath
    Chris McGrath avatar
    23 posts
    Member since:
    Dec 2009

    Posted 08 Jul 2010 Link to this post

    To anyone else who has this problem, the property you're looking for is CurrentPageIndex = 0 right before calling Rebind().
  4. Dan
    Dan avatar
    31 posts
    Member since:
    Nov 2009

    Posted 13 Jul 2010 Link to this post

    Thanks, Chris, that's exactly what I was looking for!
  5. Mir
    Mir avatar
    1 posts
    Member since:
    Sep 2010

    Posted 14 Oct 2010 Link to this post


    I have the exact scenario as the original poster. I have a grid on the page, when the user click on the Search button that is when I call CurrentPageIndex = 0 and call rebind() afterwords. Still my grid remembers the previous index number.

    1. When the user lands the page for the first time, I set the Grid's visiblity to false.
    2. When the user clicks for the first time, I click on the Grid's visible to true, which make it call NeedDataSource intern.
    3. For the subsequent clicks on the search button, I call the following code.
         RadGrid1.CurrentPageIndex = 0;
         RadGrid1.Rebind(); // This calls the NeedDataSource, where I see current PageIndex is the old one.

    Please let me know how you guys have fixed this issue.

  6. NEMEE
    NEMEE avatar
    10 posts
    Member since:
    Jul 2011

    Posted 08 Nov 2011 Link to this post

    Hi Mir,
    That help me also, to reset page Index in  Telerik Grid When Enable Pagging and Add new record after click Next Page 
  7. Yosief
    Yosief avatar
    26 posts
    Member since:
    Mar 2008

    Posted 07 May 2012 Link to this post

    Hi Mir

    Apparently setting CurrentPageIndex to 0 and calling DataBind or ReBind after is not enough sometimes. You need to enable ViewState too.

    Hope this helps
  8. Christopher Lee
    Christopher Lee avatar
    24 posts
    Member since:
    Mar 2006

    Posted 30 Jul 2018 in reply to Chris McGrath Link to this post

    Chris, thanks also for this tip. Very helpful!
Back to Top