Environment: asp.net fx3.5
I’m using the objectdatasource for my gridview. At first, I load up my gridview with records from a generic List<Attachments> for my customer. Next I’d like to add/remove items from the gridview without hitting database until after all the add/removes are done. Then the user will hit Save button and then I will persist the items in the gridview.
My question is how do I add/remove items in the gridview while the objectdatasource is wired up to gridview? My guess is somehow cast the gridview rows back to generic list, and add/remove items, and rebind? Is that even possible?
Since you will just be using the grid events to store all this information off for processing, the only thing you would need in your datasource is a select method, that way it won’t try to update/Insert the records. You can do all your event handling on the rowCommand event.
As for what you are trying, I don’t think its a good idea. You will have to track multiple records in your session, or a seperate DB table (but then what would be the point?).