How would you delete objects after save ?

24 views
Skip to first unread message

Stelio Macumbe

unread,
Mar 21, 2013, 10:57:16 AM3/21/13
to mybatis...@googlegroups.com
Hi,

I have a  form with a GridView (bound to a list of POCOs), a delete row button and a save button. The delete button only removes the items from the gridview (through gridview.DeleteRow()), the save button would then remove,update or add the actual rows from the database.  The problem is when items are removed from the gridView they are also removed from the underlying data source.

Given that I am not a very good programmer, I am curious to know how would smarter programmers accomplish this ? 

I considered
a) Adding a RowStatus flag to each POCO, it would let me know if the row was meant to be added , updated or deleted ? But how would I hide the deleted rows from the gridView ?
b) Creating a list for removed items , before an item is removed from the view I could copy it to a "removed items list" ?

Any ideas would be really appreciated

Best Regards,
Alex
Reply all
Reply to author
Forward
0 new messages