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

setting page no programattically

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ranjan
Top achievements
Rank 1
Ranjan asked on 03 Jan 2012, 02:15 PM
Hi,
I have rad grid and binding data to that on page load and paging is on. By default it is displaying page 1 of grid. I want to set page no pro-grammatically. For example there is  a button and on click of that page 2 will display and button is outside the grid. Thanks in advance....

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jan 2012, 02:54 PM
Hello,

Try the following code snippet.
C#:
protected void Button2_Click(object sender, EventArgs e)
  {
      int val = RadGrid1.CurrentPageIndex;
      int count = RadGrid1.PageCount;
     
      if (val == (count-1))
      {
          RadGrid1.CurrentPageIndex = 0;
      }
      else
      {
          RadGrid1.CurrentPageIndex = val + 1;
      }
      RadGrid1.Rebind();
  }

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