views:

178

answers:

1

I'm making an ASP.NET Web Forms application. I would like to get a DataSource which takes its data from a DataTable, and this table is persisted among requests (preferably in session, not ViewState).

The idea is that there is a need for some fairly complex forms where there are several gridviews in each of them. All the gridviews have to have edit functionality (we're using DevExpress), but there has to be one giant "SAVE" button on the form, which saves everything.

So it would be nice if I could get some kind of a DataSource that I could bind these GridViews against and which would only store the data in memory. When the user clicks the Save button I would then manually query these DataSources and extract the changed data from them.

Is there something existing for this, or must I write my own (seems to be a pretty large task)?

A: 

The scenario you have described;

  1. Retrieve data from datasource and store in datatable
  2. Store datatable in session-state.
  3. Modify datatable from different grids

Sounds like it will work, issues that i can see you having is that you'll have to reload the data between grids when the data changes. You'll have to write a class that'll raise events when changes are made to the datatable (which you'll probably also want to include in the class, and just store the class object in session state).

I hope the datatable isn't too too big... as this isn't the sort of approach i'd take for a web app.

GordonB
Umm... well, there will be one datatable per GridView. I don't intend to edit the same DataTable from different GridView's. But yes, I know that I can't stuff too much data in there, and I'll take care of that.
Vilx-
The tricky part is that the GridView's will have to be bound to something they can *edit*. If I just bind them to the DataTable directly, I can see the data, but editing fails with an exception.
Vilx-
I can do this - but the question is - isn't there something existing for this already that I can reuse?
Vilx-