move to page with domaindatasource and datapager

8 posts, 1 answers
  1. Andrea Marchetti
    Andrea  Marchetti avatar
    16 posts
    Member since:
    Jul 2005

    Posted 28 Jun 2011 Link to this post

    I have a Radgridview a raddatapager and raddomaindatasource. I need to go to a specific page after the Load event of raddomaindatasource. With riacontrols domaindatasource, i set the pageIndex of DataPager , in LoadedData event. I tried to do the same thing with the raddomaindatasource but remains on the first page. you have any suggestions. Thanks in advance.
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 28 Jun 2011 Link to this post

    Hello Andrea Marchetti,

    I will prepare a sample project for you, but let me make sure that I understand the requirements.

    You want the domain data source to move to page x the first time ever it loads data from the server. From then on it will respond to user input normally, i.e. this will be a single operation only the first time. In case I am missing something, now is the time to explain your exact requirements and I will do my best to prepare a sample project.

    Thanks in advance.

    Best wishes,
    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 28 Jun 2011 Link to this post

    Hi Andrea Marchetti,

    Please see the attached project. You should use a Dispatcher.

    I hope this helps.

    Regards,
    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Andrea Marchetti
    Andrea  Marchetti avatar
    16 posts
    Member since:
    Jul 2005

    Posted 28 Jun 2011 Link to this post

    My requirement is this: I use a window to update my records (I open it via a button on the row). When I close the window, I force a domaindatasource.Load () to update data in gridview. I want the gridview to remain on the page that contains the changed record. I save the pageIndex DataPager in LoadingData event (raddomaindatasource), then set it in LoadedData event. With riacontrols domaindatasource worked, but with raddomaindatasource, always returns to the first page.

    Thanks
  6. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 28 Jun 2011 Link to this post

    Hello Andrea Marchetti,

    Can you take a look at the sample project I have attached. I have used a Dispatcher and everything worked correctly.

    I hope this helps.

    Best wishes,
    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Andrea Marchetti
    Andrea  Marchetti avatar
    16 posts
    Member since:
    Jul 2005

    Posted 28 Jun 2011 Link to this post

    thanks for the fast response. I tried your example and it works perfectly. I put the changes in my project .... but does not work. My project is in VB. Are correct following instructions?

    Private

    Sub View_immobiliDomainDataSource_LoadedData(ByVal sender As System.Object, ByVal e As Telerik.Windows.Controls.DomainServices.LoadedDataEventArgs)

     

     If DataPager1.PageIndex = -1 Then

         Me.Dispatcher.BeginInvoke(Function() DataPager1.PageIndex = 3)

     End If
    ...

     

  8. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 28 Jun 2011 Link to this post

    Hello Andrea Marchetti,

    I am not a VB specialist, but the code seems okay to me. Is it actually executed? Can you use the debugger? Does the debugger reach the code I suggested? Does it go inside the if?

    You can add a boolean flag that will tell you whether you have performed this one-time operation and perform it according to this boolean flag instead of relying on the fact that PageIndex is -1, since I really don't know what you are doing in your project. Obviously, you are doing something different than my sample project, but you are the only one that knows what is it, since you now have both projects.

    What is the difference between my sample project and yours?

    Can you send me a dummy version of your project but only with the relevant stuff concerning this issue. In other words, I don't need your entire project with all kinds of other stuff but a dummy version of it that demonstrates what you are doing. I also need to be able to compile and run it without problems. In this way I will be able to debug it and see what is going on.

    Thanks in advance.

    Kind regards,
    Ross
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Andrea Marchetti
    Andrea  Marchetti avatar
    16 posts
    Member since:
    Jul 2005

    Posted 28 Jun 2011 Link to this post

    thanks again, problem solved. the correct code is:

     

     

    Private Sub View_immobiliDomainDataSource_LoadedData(ByVal sender As System.Object, ByVal e As Telerik.Windows.Controls.DomainServices.LoadedDataEventArgs)

     If DataPager1.PageIndex = -1 Then

        Me.Dispatcher.BeginInvoke(AddressOf ChangePage)

     End If

     ...
    End Sub

     

     

     

     

    Private Sub ChangePage()

         Me.DataPager1.PageIndex = 2

    End Sub

     

Back to Top
DevCraft banner