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

Scroll to newly added item in RadGrid?

1 Answer 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gotcha
Top achievements
Rank 1
Gotcha asked on 10 Dec 2012, 05:50 AM
Hi,

Let's say I have a RadGrid with 20 items and As I add an item to the grid, it refreshes and scrolls to the newly added item in the list ?

Can you tell me if it is possible to do... any sample is greatly appreciated.

Thanks

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 10 Dec 2012, 03:21 PM
Hello,

As I understand the paging in your grid is not enabled. If so, you can try the approach from the following help article:
Scrolling to the Selected Item

You could select the item on RadGrid PreRender as shown below:
bool shouldSelect;
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.PerformInsertCommandName)
    {
        shouldSelect = true;
    }
}
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (shouldSelect)
    {
        RadGrid1.SelectedIndexes.Add(RadGrid1.MasterTableView.Items.Count - 1);
    }
}

Kind regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Gotcha
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or