Question about viewstate

B

Bill Yeager

I have a grid that I databind with a strongly typed
dataset which contains thousands of records retrieved
from a database. After the dataset is retrieved from the
database, I place it in viewstate. I need to do this
because of the following:

A user is allowed to check "x" amount of rows on the grid
and submit those records (which causes a postback) to the
database for updating. At this point, I grab the dataset
from viewstate and simply process those records from the
appropriate event. The records in the dataset are
processed depending on which rows were checked on the
grid. The syncing of rows in the grid to the dataset is
exactly the same which is expected.

However, based on the dataset being large, this can
reduce performance because of the dataset which was
placed in viewstate. If I don't place the dataset in
viewstate and grab the records from the database again
performing the databind, the rows that the user checked
will be lost. Even if I somehow save the rows that were
checked via viewstate in between postbacks and apply that
to the dataset after the databind, the application runs
the risk of the rows being out of sync on the datagrid to
the dataset, because some other user could have processed
those rows. If custom paging is implemented on the grid,
I suppose this would reduce the work load on the data in
viewstate which defintely would be acceptable. If not
using custom paging, this scenario would still exist.

Can somone please shed some light on whether or not my
thinking is correct?
How would one deal with this scenario?
 
K

Kevin Spencer

I doubt that you can very well display thousands of records in a single HTML
document. Perhaps you should only fetch 100 at a time.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
K

Ken Varn

What about trying to use SessionState instead? Granted, this uses more
server memory, but it definitely will cut down on the amount of data that
you have to pass back and forth to the client.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top