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

Two different DomainDataSources use same DomainContext

5 Answers 42 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
W
Top achievements
Rank 1
W asked on 06 May 2016, 08:50 AM

I have a DataForm and a GridView binding to two different DomainDataSources(use same DomainContext).

The DataForm.CurrentItem's navigation property able to modify from GridView.SelectedItem.

The first load GridView is fine,when I reload,the GridView's DomainDataSource didn't load(same query).

Even LoadingData not raised, so set e.LoadBehavior = LoadBehavior.RefreshCurrent is invalid.

5 Answers, 1 is accepted

Sort by
0
W
Top achievements
Rank 1
answered on 09 May 2016, 11:21 AM
Thanks for any help...any help...!
0
Maya
Telerik team
answered on 09 May 2016, 02:02 PM
Hi,

Could you clarify why you are working with two different instances of RadDomainDataSource? What is the behavior that you want to achieve? 

Regards,
Maya
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
W
Top achievements
Rank 1
answered on 10 May 2016, 12:11 AM

Thanks for reply me.

I have a DataForm in a page. The navigation property use HyperlinkButton,when click the HyperlinkButton,then popup a Childwindow.

The Childwindow contain  a GridView and a DomainDataSource, the DomainDataSource.DomainContext came from the page.

When the Childwindow closed, the DataForm in the page will get the GridView.SelectedItem to set DataForm.CurrentItem's navigation property..

The issue is:First click the HyperlinkButton to open the Childwindow is fine, the second time, the DomainDataSource in Childwindow LoadingData not raised.

The reason why use same DomainContext is: Can't set entity's navigation property,which from two different entitycontainer.

0
W
Top achievements
Rank 1
answered on 10 May 2016, 06:13 AM

I see now.

If DomainDataSource is changed, the HasChanges will be set true, and CanLoad will be set false.

Then any load will be canceled.

0
Maya
Telerik team
answered on 11 May 2016, 07:29 AM
Hello,

Generally, you can try working with QueryableDomainServiceCollectionView and share the same instance of the collection. More information can be found in the "MVVM approach to Telerik Domain Services" article. 

Regards,
Maya
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
DomainDataSource
Asked by
W
Top achievements
Rank 1
Answers by
W
Top achievements
Rank 1
Maya
Telerik team
Share this question
or