Navigation and selection issues in UnboundMode

4 posts, 0 answers
  1. Ates
    Ates avatar
    15 posts
    Member since:
    Nov 2010

    Posted 25 Mar 2015 Link to this post

    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
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 27 Mar 2015 Link to this post

    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.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ates
    Ates avatar
    15 posts
    Member since:
    Nov 2010

    Posted 30 Mar 2015 in reply to Dimitrina Link to this post

    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
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 01 Apr 2015 Link to this post

    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.

     
Back to Top