Updating Disconnected DataSets with GridView

I

ist

Hi,
I am trying to create a Session-Wide, Disconnected, Updatable
DataTable (or DataSet) object and use it through an ASP.NET GridView.

The scenario is this:

1. When the page is first loaded, connect to DB, get data, fill
DataTable.
2. Bind DataTable to GridView. Set DataTable as a Session object.
3. User continues navigating page, but after first load, no more DB
connection is made, grid is filled from DataTable Session object.
4. Sometime, user sets GridView to edit mode and makes some changes.
Then he clicks Update button on GridView.

This is where I fail. I somehow imagine that there must be a way to
reflect user's change on Gridview to DataTable Session object (NOT to
actual DB)

So when user continues navigating page, he will see updated data
(since DataTable is Session-wide) however the actual DB is not
updated.

I've tried triggering GridView1.UpdateRow(e.RowIndex, false) on
GridView1_RowUpdating event but it gives me stack overflow (huh?)
error.

Thanks...
 
M

Muhammad Naveed Yaseen

I've tried triggering GridView1.UpdateRow(e.RowIndex, false) on
GridView1_RowUpdating event but it gives me stack overflow (huh?)
error.

It is supposed to overflow because of recursive callback (UpdateRow
itself raises RowUpdating event, from where it is getting called
again).

In any case GridView's automatic row update is intended for
DataSourceControl (i.e. the one set by by DataSourceID instead of
DataSource). Your best bet is probably to manually update the table
stored in Session state in RowUpdating or RowCommand event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top