State managment

V

Vik

A Web page contains a search function, which fills out a dataset and stores
it in a Session state. A user can navigate through the stored records. If
the user opens a new browser window from the existing one and enters another
search criteria, then the new dataset overrides the dataset from the
previous window in the session state and both windows display the same
results though the search criteria look different.
When the dataset is stored in a view state loading the page takes forever.

How can I solve this problem? Should I retrieve data from a database every
time the page is loaded?

Thanks.
 
M

Marina

If these are your requirements, then yes. At any one time, you should only
retrieve the records you need though. So if you are display 10 at a time,
grab 1-10 the first time, when they hit Next, grab the next 10.

The other way you could do it, is to assign each page a new GUID on the
first page_load and store the GUID in viewstate. Then, if your session
variable name is "SearchResults", name it : GUID + "SearchResults". That
way there will be unique session variables for each page, since each one
will have a unique guid that it has created at start up. This works if you
don't mind having multiple sets of data in session at the same time.
 
V

Vik

Thank you.

I already tried assigning PageID = Now. This works if a user opens the new
window before the page is posted back. After the page is posted back opening
the new window does not call Page_Load procedure, so PageID remains the same
as on the first page.

Vik
 
T

Tommy

For each search query, save the results in a file on the applicaton
server. When the user page through these results, you can just read
from the file instead of querying the database again.

With each unqiue search query in a separate file, the user can have
multiple view of the same data without having to constantly query the
database.

You can also have a component running in COM+ under a user that has
write permissions on the web server to save the files.

Tommy,
 

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

Latest Threads

Top