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

RadGridViewCommand BeginInsert with DataPager

3 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ricky
Top achievements
Rank 1
Ricky asked on 10 Jun 2014, 03:54 PM
I am using the RadGridViewCommand BeginInsert with a RadGrid that uses a DataPager. 

I used the AddingNewDataItem completed event to attempt to move the datapager to the last page to accommodate multiple pages. When adding the item to increase the page size from 1 to 2 pages, the AddingNewDataItem event fires to move the DataPager to the last page. However, at that moment the page size is still 1.

How can I use the RadGridViewCommand BeginInsert and use multiple pages? 

Also is there a way to use the RadGridViewCommand BeginInsert to insert to the beginning of the list rather than the end?

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 13 Jun 2014, 04:09 PM
Hi,

You cannot insert at the beginning of the list using the BeginInsert command.
You can check the Insert New Row into Paged GridView help article, however the page size will not be changed until adding the new item has been committed.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Ricky
Top achievements
Rank 1
answered on 13 Jun 2014, 05:09 PM
Hi Didie,

Thanks for the reply. I have tried that code from the article before posting:

private void clubsGrid_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
    {
        ((RadGridView)sender).Items.MoveToLastPage();
    }

As you mentioned, at the time that the GridViewAddingNewEventArgs is triggered, the new item still hasn't been committed. In the example of adding the next item that would increase the page size from 1 to 2, the code from the example would leave the user on the first page.

Is there any other event fired that pager.MoveToLastPage() could be used to get the desired effect of moving to the last page in this example?
0
Dimitrina
Telerik team
answered on 17 Jun 2014, 10:25 AM
Hi,

There is not another event I can suggest. You can try executing the code for moving to the last page in a Dispatcher.
For example:
private void clubsGrid_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
  Dispatcher.BeginInvoke(new Action(()=>{
 
    ((RadGridView)sender).Items.MoveToLastPage();
}));
}

Let me know how this works for you.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Ricky
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Ricky
Top achievements
Rank 1
Share this question
or