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

Getting the ID of the new item

3 Answers 17 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 02 Nov 2011, 10:32 AM

When using the QueryableDomainServiceCollectionView to add a new item, how can i get the Id of that item?
If after SubmitChanges() i call the CurrentItem property, will that be the newly created item? If so i can simply take the ID from that.
I am not sure what the behaviour is here.

Thanks

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 02 Nov 2011, 10:39 AM
Hi Andrew,

How are you adding this new item? Don't you have a reference to its instance? Can't you save a reference to this item and then after you call SubmitChanges go and check its ID.

In case that does not help, could you please send us a small dummy project that show what you are doing and we will try to help.

Greetings,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Andrew
Top achievements
Rank 1
answered on 04 Nov 2011, 08:44 AM
I add the Item with AddNew method.
It looks like the CurrentItem is the correct new item.

All i am really looking for is a confirmation for that.
0
Rossen Hristov
Telerik team
answered on 04 Nov 2011, 09:29 AM
Hello Andrew,

Correct me if I am wrong, but doesn't the AddNew method actually return your new item?

Regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

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