I have a GridView with an ObjectDataSource. I want to let the user create several objects and then save them in one go.
Background: I want to create an editor for a recipe. A recipe has base properties (like name and origin) and it has ingredients (like 100 g butter) I want the user to set all properties of the recipe and let him define its ingredients before (!!) saving it to the database. Also it must be possible to delete an ingredient from the list. Saving the recipe first and then defining the ingredients is not an option.
My Question: Where do I keep the ingredients before they are saved to the database?
This what I found out:
- ViewState is not an option because the GetData method of the ObectDataSource is static and therefore cannot access the viewstate.
- Session is not an option because users should be able to use the same page in different tabs of the same browser at the same time.
- Context is not an option because it does not survive the callback.
- Using LinqDataSource instead of ObectDataSource does not work because it does not support delete operations if the data source is not a linq data context.
- Using a unique ID in the QueryString (to identify the correct session object) would be a workaround but it messes up the URL.
I have been searching the web for a while and I have tried a lot of things without success.
Thank you very much for any help and any suggestions!!