Reset RadGrid Page Index after Filtering.

2 posts, 0 answers
  1. L. M. Pathan
    L. M. Pathan avatar
    20 posts
    Member since:
    Dec 2009

    Posted 15 Jun 2012 Link to this post

    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.
  2. Rahul
    Rahul avatar
    27 posts
    Member since:
    Jul 2015

    Posted 07 Aug 2015 Link to this post

    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;
Back to Top