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

Navigation and selection issues in UnboundMode

3 Answers 70 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 25 Mar 2015, 01:21 PM
Hello

I am using the RadDataPager in UnboundMode in connection with a RadGridView or a RadListBox.
The data from a page are loaded by an Event PageIndexChanged.
How can I navigate to a certain page (for example page 3) or select a certain element in Code-Behind or in XAML.
The commands PageIndex=3 or MoveToPage(3) seem to have no effect.

Sincerely,
A. Kasar

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 27 Mar 2015, 05:17 PM
Hello A. Kasar,

When using Unbound mode, you have total control to set the paged source, number of pages, etc. I tested moving between the pages and as it turns out the PageIndexChanged event is only raised initially and it is not invoked as the MoveToPage(3) method is called.

In that case, you can subscribe for the PageIndexChanging event and set the ItemsSource there:
private void radDataPager_PageIndexChanging(object sender, PageIndexChangingEventArgs e)
{
    this.clubsGrid.ItemsSource = this.data.Skip(e.NewPageIndex *       this.radDataPager.PageSize).Take(this.radDataPager.PageSize).ToList();
}

I hope this helps.

Regards,
Dimitrina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Alex
Top achievements
Rank 1
answered on 30 Mar 2015, 03:34 PM
Hello

Thanks for your help. I also need to know how I can set the page number on RadDataPager in unbound mode per code without any interaction on UI. Setting the property PageIndex=3 or calling method MoveToPage(3) seem to have no effect.

Sincerely,
A. Kasar
0
Dimitrina
Telerik team
answered on 01 Apr 2015, 01:29 PM
Hello,

I tested changing the PageIndex from code and it worked fine. This is my code:
private void Button1_Click(object sender, RoutedEventArgs e)
{
    this.radDataPager.MoveToPage(3);
}
 
private void Button2_Click(object sender, RoutedEventArgs e)
{
    this.radDataPager.MoveToPage(2);
}
 
private void radDataPager_PageIndexChanging(object sender, PageIndexChangingEventArgs e)
{
    this.clubsGrid.ItemsSource = this.data.Skip(e.NewPageIndex * this.radDataPager.PageSize).Take(this.radDataPager.PageSize).ToList();
}

The other option would be to bind the pager to something that implements the IPagedCollectionView interface. 

In case this does not work for you, would it be possible for you to illustrate the specific case in a demo project with your exact setup and send it to us via a new support thread? You can also take a look at this blog post for a reference on how to isolate an issue.  

Regards,
Dimitrina
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
DataPager
Asked by
Alex
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Alex
Top achievements
Rank 1
Share this question
or