DataGrid with values not saved to the database but want to sort it.

U

UJ

I have a datagrid where I load the values initially and then the user can
make changes to the data. That all works fine. But I want to add column
sorting which I've done before. That works fine. Problem is putting the two
together because every example of sorting I have seen shows going back to
the database. But I haven't saved my changes yet so I can't go back to the
database.

Here's an example:
Load page - read from the database.
Person changes a value on record 1
Person changes a value on record 3
They then actually save the values to the database.

But if sorting goes back to the database, then is they sort after record 1
changes, they will lose those changes.

I don't want to write out the changes until they decide they want to save
everything.

Any ideas?

TIA.

Jeff.
 
B

Brock Allen

I don't want to write out the changes until they decide they want to
save everything.

So you will need to store these changes somewhere. How are you rebuilding
the grid when the users sorts? Are you going back to the database? If so,
then you'd need to DataBind from your database, and then for any data the
user has changed you'd need to overwrite the data loaded from data binding.
So I'd look into the DataGrid's ItemDataBound event to get the row that was
just data bound and manually overwrite the data as necessary. How do you
store the data? That's up to you. Perhaps a DataSet stored in Session? Just
an idea.
 

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

Forum statistics

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

Latest Threads

Top