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

Reset RadGrid Page Index after Filtering.

1 Answer 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L. M. Pathan
Top achievements
Rank 1
L. M. Pathan asked on 15 Jun 2012, 06:52 AM
Telerik Team,

We are using telerik rad grid and have implemented custom paging on it. Hence grid maintains page index while filtering and sorting. Now the issue is say for example page size is 50 and we have 150 records the three page will appear. Now if user go to page number 3 and filters any column which returns only 1 records. Obviously when grid rebinds it will only have one page. One page number shows on the grid. But grid shows no records. Now if I click on page number 1, of course it shows records.

I checked by debugging, in this case PageCount property shows 1 which is less than the out CurrentPageIndex.

How do we dynamically reset the page number from code behind. We don't want to always set page index to 0. Hope this makes sense. Thank you.

Pathan  L.

1 Answer, 1 is accepted

Sort by
0
Rahul
Top achievements
Rank 1
answered on 07 Aug 2015, 01:40 PM

Hi there,

I know this is older post, may be helpful for others.

whever OnNeedDataSource event called you just need to do in this event

if (RadGrid1.MasterTableView.Items.Count < RadGrid1.PageSize)
            RadGrid1.CurrentPageIndex = 0;
Tags
Grid
Asked by
L. M. Pathan
Top achievements
Rank 1
Answers by
Rahul
Top achievements
Rank 1
Share this question
or