Best place to hold dataset between postbacks?

G

Gandalf

I have a page with a datagrid that is bound initially to a dataset. As the
user changes items on the grid, I want to cache the changes until a final
submit. Ideally I wish to update the dataset on each postback and at the
end, submit the changes to the database. But where should I store the
dataset? I can put it into the viewstate, but that gets very large, or I can
put it in a session object. Which of these two is better? Are there any
other alternatives?

Thx
 
S

Steve C. Orr, MCSD

In most situations Session state would likely be the best place. Remember
to deallocate when you're done with it so it will eat a minimal amount of
memory. Even then it will take a significant amount of server memory for a
while, which will put limitations on the scalability of your app. Using
viewstate would offload some of that work to the client, but will increase
your bandwidth needs. Another option would be to use a staging table in the
database to save between each request. Of course this puts more load on
your SQL Server.
It's all about trade offs. No matter how you do it, the work has got to go
somewhere, in some tier. Pick one. How about the least used one?
 

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,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top