This is a migrated thread and some comments may be shown as answers.

RadGrid and paging reset

7 Answers 1108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
B.
Top achievements
Rank 1
B. asked on 15 Mar 2010, 04:03 PM
Hello.

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.

Bérénice

7 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetoslav
Telerik team
answered on 16 Mar 2010, 03:00 PM
Hello,

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

Best wishes,
Tsvetoslav
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.
0
Chris McGrath
Top achievements
Rank 1
answered on 08 Jul 2010, 09:09 PM
To anyone else who has this problem, the property you're looking for is CurrentPageIndex = 0 right before calling Rebind().
0
Quinten
Top achievements
Rank 1
answered on 13 Jul 2010, 08:28 PM
Thanks, Chris, that's exactly what I was looking for!
0
Mir
Top achievements
Rank 1
answered on 14 Oct 2010, 05:16 PM
Hi,

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.

Regards,
Hari
0
NEMEE
Top achievements
Rank 1
answered on 08 Nov 2011, 02:40 PM
Hi Mir,
That help me also, to reset page Index in  Telerik Grid When Enable Pagging and Add new record after click Next Page 
Thanks
0
Yosief
Top achievements
Rank 2
answered on 07 May 2012, 12:31 PM
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
Yosief
0
Christopher Lee
Top achievements
Rank 1
answered on 30 Jul 2018, 02:33 PM
Chris, thanks also for this tip. Very helpful!
Tags
Grid
Asked by
B.
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Chris McGrath
Top achievements
Rank 1
Quinten
Top achievements
Rank 1
Mir
Top achievements
Rank 1
NEMEE
Top achievements
Rank 1
Yosief
Top achievements
Rank 2
Christopher Lee
Top achievements
Rank 1
Share this question
or