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

move to page with domaindatasource and datapager

7 Answers 96 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Andrea Marchetti
Top achievements
Rank 1
Andrea Marchetti asked on 28 Jun 2011, 09:43 AM
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.

7 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 Jun 2011, 09:58 AM
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
0
Accepted
Rossen Hristov
Telerik team
answered on 28 Jun 2011, 10:18 AM
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
0
Andrea Marchetti
Top achievements
Rank 1
answered on 28 Jun 2011, 10:26 AM
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
0
Rossen Hristov
Telerik team
answered on 28 Jun 2011, 10:27 AM
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
0
Andrea Marchetti
Top achievements
Rank 1
answered on 28 Jun 2011, 11:16 AM
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
...

 

0
Rossen Hristov
Telerik team
answered on 28 Jun 2011, 11:55 AM
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
0
Andrea Marchetti
Top achievements
Rank 1
answered on 28 Jun 2011, 12:41 PM
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

 

Tags
DomainDataSource
Asked by
Andrea Marchetti
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Andrea Marchetti
Top achievements
Rank 1
Share this question
or