Edit this page

Scroll to newly added item

This article shows how to scroll RadGridView to the newly added item.

When you insert a new item, it is added as last item in of RadGridView. If you want to scroll to it, you will have to handle RadGridView's RowEditEnded event and execute the following code:

C#

private void clubsGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{
    if (e.Row is GridViewNewRow)
    {
        this.clubsGrid.SelectedItem = e.Row.Item;
        this.clubsGrid.ScrollIntoView(this.clubsGrid.SelectedItem);
    }
}

VB.NET

Private Sub clubsGrid_RowEditEnded(sender As Object, e As GridViewRowEditEndedEventArgs)
    If TypeOf e.Row Is GridViewNewRow Then
        Me.clubsGrid.SelectedItem = e.Row.Item
        Me.clubsGrid.ScrollIntoView(Me.clubsGrid.SelectedItem)
    End If
End Sub