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

[Solved] RadGrid automatic go to last page on first load

4 Answers 394 Views
Grid
This is a migrated thread and some comments may be shown as answers.
New
Top achievements
Rank 1
New asked on 14 Sep 2009, 09:13 AM
Hi,

I have a big problem, I'm not be able to make that the radgrid on first load dysplays the last page.

How to I can do this?

Thanks

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 14 Sep 2009, 09:23 AM
Hi New,

Try out the following code snippet to achieve the desired scenario.

CS:
 
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        if (!IsPostBack) 
        { 
            RadGrid1.CurrentPageIndex = RadGrid1.PageCount - 1; 
            RadGrid1.Rebind(); 
        } 
    } 


Regards
Princy
0
New
Top achievements
Rank 1
answered on 15 Sep 2009, 04:00 PM

Thank you!

I tried that way but it did not work because I had forgotten to call Rebind() method.

Now works fine! Thanks!

I have another question: there is a way to scroll the grid to show the last records... in few words: can I set the scroll to end of the page?
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Sep 2009, 04:39 AM
Hi,

Here is a help article which explains how to scroll to the selected item on the client side. You may try a similar approach to achieve the desired scenario.

Thanks
Princy
0
New
Top achievements
Rank 1
answered on 19 Jan 2010, 08:29 AM
Hi,

javascript scroll works fine... but the last page navigation not work any more because now I have new scenario and my page when load is yet on postback state... an ipotetic solution is setting a bool when che pager button are pressed and in this case not navigate to che last page... but I don't now to do this, can you help me please?

protected void RadGrid1_PreRender(object sender, EventArgs e)    
    {    
        if (!bIsPagerPressed)  
        {    
            RadGrid1.CurrentPageIndex = RadGrid1.PageCount - 1;    
            RadGrid1.Rebind();    
        }    
    }    
 

New
Tags
Grid
Asked by
New
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
New
Top achievements
Rank 1
Share this question
or