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

Page to New Row

3 Answers 18 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kelly
Top achievements
Rank 1
Kelly asked on 18 Mar 2013, 05:21 PM
Is it possible to have a paged grid automatically page to the new row when the BeginInsert command is called?

Thanks!

-k

3 Answers, 1 is accepted

Sort by
0
Kelly
Top achievements
Rank 1
answered on 18 Mar 2013, 06:53 PM
I'm trying this:

        private void ContactsGrid_AddingNewDataItem(object sender, GridViewAddingNewEventArgs e)
        {
            // Make sure we're on the proper page 
            e.OwnerGridViewItemsControl.Items.MoveToLastPage();

            // Make sure the grid goes to the first column
            e.OwnerGridViewItemsControl.CurrentColumn = e.OwnerGridViewItemsControl.Columns[0];
        }

So lets say I have a pager with PageSize = 10.  When I add the 11th row, it does not page.  However, when I add the twelfth row it does.  It looks like the pager hasn't added the second page by the time this event is executed.

-k
0
Yoan
Telerik team
answered on 21 Mar 2013, 01:57 PM
Hello Kelly,

I can suggest you to set the RadGridView.ItemsSource property to your data and bind the RadDataPager.Source property to the RadGridView.Items property. Then in the AddingNewDataItem event you can invoke the MoveToLastPage method like so:

((RadGridView)sender).Items.MoveToLastPage();

For your convenience, I have prepared a sample project. Please give it a try and let me know if it fits in your scenario.



Greetings,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Kelly
Top achievements
Rank 1
answered on 22 Mar 2013, 01:35 PM
Thanks!
Tags
GridView
Asked by
Kelly
Top achievements
Rank 1
Answers by
Kelly
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or