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

Hide / Disable unnecessary paging buttons?

2 Answers 565 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 25 Apr 2013, 03:21 PM
In the GridView paging control, currently when you are on the last page, the buttons for "next page" and "last page" still appear, and still look active. The same goes for previous/first page buttons on the first page, and all the buttons when viewing fewer items than the current page size so that there's only 1 page total.

This has caused some confusion to our users, who think that something is not working right because they can still push the "next page" button, but it doesn't do anything. Is there a way that these buttons can be hidden, or at least noticeably disabled?

I know that there's the option to hide the pager control when there is only 1 page anyway, but that's no good because then the user cannot change the current page size, as it hides the page size dropdown as well.

Is there a chance that this will be fixed / updated in a future version?

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Apr 2013, 04:37 AM
Hi,

Please try the following code snippet to hide the 'Previous' and 'First' button from First page and 'Next' and 'Last' button from last page.

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
      if (e.Item is GridPagerItem)
      {
             GridPagerItem pagerItem = (GridPagerItem)e.Item;
             if (pagerItem.Paging.IsFirstPage)
             pagerItem.CssClass = "RadFirstPage";
             else if (pagerItem.Paging.IsLastPage)
             pagerItem.CssClass = "RadLastPage";
        }
}

CSS:
<style type="text/css">
       .RadFirstPage .rgPageFirst, .RadFirstPage .rgPagePrev
       {
           display: none !important;
       }
       .RadLastPage .rgPageNext, .RadLastPage .rgPageLast
       {
           display: none !important;
       }
 </style>

Thanks,
Princy.
0
Robert
Top achievements
Rank 1
answered on 26 Apr 2013, 01:48 PM
That works, thanks!
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Robert
Top achievements
Rank 1
Share this question
or