This is a migrated thread and some comments may be shown as answers.
Need to disable First Row, prev button and Last Row,next buttons in radgrid pager
1 Answer 106 Views
This is a migrated thread and some comments may be shown as answers.
Krishnan LN
Top achievements
Rank 1
Krishnan LN asked on 22 Sep 2010, 12:23 PM
Hi,
I have a requirement in RadGrid.
I have a grid assume there are 2 pages in it. When im on the first page , then Go to first Page and prev buttons has to be disabled.
When im on the last page then go to next page and go to last page buttons has to be disabled.
Is there any provisions in telerik radgrid for that?

Regards,
Krishnan

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 23 Sep 2010, 02:21 PM
Hello Krishnan,

One option is hiding the Next/Prev button using CSS. Check out tehe following code snippet.

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>

You can also refer the following documentation which explains how to access the elements of advanced pager. After accessing that pager elements, you can disable it from code behind.
Accessing the elements of advanced type pager

Thanks,
Princy.


Tags
Grid
Asked by
Krishnan LN
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or