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

scroll to last row of RadGrid after binding?

1 Answer 370 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 13 Oct 2011, 04:52 PM
I searched the site for this question, sorry if I missed it.

I have a RadGrid.  I add to the datasource.  I rebind the datasource to the grid.  I want the grid to be 'scrolled' to the bottom after the postback so the user can see the row they added.  How is that done?  Currently after the postback the grid is 'scrolled' to the top.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Tom
Top achievements
Rank 1
answered on 13 Oct 2011, 07:47 PM
The solution that works for me is:

use the prerender event on the radgrid
in the codebehind set the focus to the last row

 

protected void RadGrid1_PreRender(object sender, System.EventArgs e)
{
try 
{
List<RowInfo> ri= (List<RowInfo>)ViewState["FeeSchedRuleList"];
rgSchedRuleMaint.Items[ri.Count - 1].Focus();
}
catch 
{
// must not be any data yet - or something went horribly wrong!
}

 

Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Answers by
Tom
Top achievements
Rank 1
Share this question
or