Hi,
How do I set a child object that has been set to delete, to undelete. Is this possible?
Basically when a user un-checks a checkbox in my checkboxlist custom control I set the child object to delete, however they then can re-tick the checkbox at which point I want to remove the deleted flag from the child object.
Thanks
Andy
Hi
I need to undelete a child object. How can I do this? An urgent solution will be highly appreciated.
Thanks
In response to the OP. Marking the object as New will remove the deleted flag.
One other possibility is to add your own editable property (ToBeDeleted or IsActive) and create your own filter on top of the list.
If the user is allows to "delete" / "undelete" in a checkbox then maybe the MarkDeleted mechanism isn't the appropriate one to use.
So when needed - I have created:
Thanks for your response.
What is the philosophy behind not having an Undelete() method?
Objects that is deleted in a list (typically) is moved to a new internal list for Deleted items.
There is no guarantee that the user may already have added a new row in the list that have the same primary key or unique key fields so that it _may_ not be safe to "undelete" the item.
So the safe processing when saving is to process
Hi Jonny,
Thanks for explaining the logic.
I have 1:1 relation between parent and an optional child. And if the child is marked as deleted, then I have no way to undelete it or create a new child. Due to this limitation, I have to use a child collection instead of a single child. With collections, it is fine to delete and then recreate the new object.
Best regards
Abbas
If you can mark it as deleted then why can't you mark it as new when you want to undelete it?
Thanks cfarren,
I can call MarkNew() and then MarkOld() to achieve the Undelete() effect. I hope this will work. Thanks for pointing out in the rigght direction.
Best regards
Abbas
Abbas,
Depending on the scenario, you might consider n-level undo as an option as well.
MarkNew/MarkOld should work as long as you don't have any logic handling PropertyChanged notification for IsNew property twice where object is new and then once again when it's old.
- ngm
Thanks cfarren,
I can call MarkNew() and then MarkOld() to achieve the Undelete() effect. I hope this will work. Thanks for pointing out in the rigght direction.
Best regards
Abbas
this is unbelieveable!
Copyright (c) Marimer LLC