I’m working on an “edit” page for an object. On this page, I would like to have something like a DetailsView allowing editing of properties of the object as well as a GridView with children and allowing for simple Add/Edit/Delete of the children. The updates to the parent or child objects shouldn’t save to the database until a Save button is clicked. I’m asp.net web forms and Entity Framework
As a simple example, imagine a Project object with a collection of Resources. I am building a page that allows a user to change Project properties such as ProjectName in a DetailsView as well as add/edit/deleting a Resource in a Gridview below. One Save button at the bottom saves everything.
I’ve found examples of this in MVC, but am having trouble finding a web forms example.
I am not able to code your application for you but I have accomplished this using one of two variants of the same pattern.
Create a record object for your children that is serializable and maintain that in a ViewState based List. If the data is significantly large, consider maintaining it in Session and use a unique key to your Session object (such as a GUID assigned at Page_Load) and stored the key in ViewState.
When your use is done editing the parent / children, you will have to resolve the changed to your ViewState / Session based objects to those stored on disk.