Getting the ID of the new item

4 posts, 0 answers
  1. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 02 Nov 2011 Link to this post

    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

  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 02 Nov 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Andrew
    Andrew avatar
    171 posts
    Member since:
    Jun 2009

    Posted 04 Nov 2011 Link to this post

    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.
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 04 Nov 2011 Link to this post

    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 >>

Back to Top