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

Hide Pager Buttons on last page

5 Answers 242 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Francesco Vivaldi
Top achievements
Rank 1
Francesco Vivaldi asked on 28 Apr 2011, 02:44 PM
Hi,

I have implemented a pager with custom button.

<PagerStyle ForeColor="Blue" Mode="NextPrevAndNumeric"
                    NextPageImageUrl="immagini/u221.png"

Works great, but i want to hide the NextPage Button on Last Page of radgrid, or when i select from combobox the max size of the PageSize.

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Apr 2011, 06:06 AM
Hello Francesco,

Here is a sample code to achieve your requirement.

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridPagerItem)
       {
           GridPagerItem pagerItem = (GridPagerItem)e.Item;
           if (pagerItem.Paging.IsLastPage)
           {
               pagerItem.Display = false;
           }
       
  }

Thanks,
Princy.
0
Francesco Vivaldi
Top achievements
Rank 1
answered on 29 Apr 2011, 08:46 AM
HI.

works great, but in this way i hide all pager item, i need to hide only the "NextButton".(black arrow in screenshot)
see attachment.
0
Pavlina
Telerik team
answered on 29 Apr 2011, 09:45 AM
Hello Francesco,

To hide only the "NextButton" in grid pager you can use the CSS class below:

.RadGrid_SkinName .rgPageNext
 {
   display:none;
 }

Regards,
Pavlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Bill
Top achievements
Rank 1
answered on 24 Jan 2013, 08:17 PM
It seems that the first answer posted hides all buttons and the second answer posted hides the Next button at all times.

But how can you hide ONLY the Next button when its the last page of the grid?
Thanks
0
Shinu
Top achievements
Rank 2
answered on 25 Jan 2013, 04:58 AM
Hi,

Try the following code to achieve your scenario.
C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
        if (e.Item is GridPagerItem)
        {
            GridPagerItem pagerItem = (GridPagerItem)e.Item;
            if (pagerItem.Paging.IsFirstPage)
                pagerItem.CssClass = "NextPage";
        }
}
CSS:
.RadNextPage .rgPageNext
{
  display: none !important;
}

Thanks,
Shinu
Tags
Grid
Asked by
Francesco Vivaldi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Francesco Vivaldi
Top achievements
Rank 1
Pavlina
Telerik team
Bill
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or