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

RadGrid Pager Template

1 Answer 252 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Babak
Top achievements
Rank 1
Babak asked on 14 Aug 2012, 06:38 AM
hi ,
I'm using Pager Template like you use in this link :
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/pagertemplate/defaultcs.aspx

but I just want to Set the previous button Disable when the Current Page Index is 1 and set Next Button disable when the Current Page Index is the last page . Last and First Button too .
thanks a lot .

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Aug 2012, 07:48 AM
Hi,

Try the following code to disable buttons based on the page index
C#:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
 if (e.Item is GridPagerItem )
 {
   GridPagerItem gridPager = e.Item as GridPagerItem;
   if (gridPager.Paging.IsFirstPage)
   {
     Button btn = (Button)gridPager.FindControl("Button2");
     btn.Enabled = false;
   }
   else if (gridPager.Paging.IsLastPage)
   {
      Button btn = (Button)gridPager.FindControl("Button4");
      btn.Enabled = false;
   }
  }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Babak
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or