By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,245 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,245 IT Pros & Developers. It's quick & easy.

General "previous page" feature saving state

P: n/a
I need to place a "Previous Page" link on every page within my site and
a simple javascript:history.back() will not work because I need it to
capture the state of the page when I left it. For example, if I have
a page with some date controls so I can choose a date range and
postback the page. It then displays results based on that date range.
When I leave the page for another page, I would like to have the
Previous Page link take them back to the page with the same date range.

I know I can do this by storing these values in session but it then has
to be specific for every page and store every value manually. Is there
a way to store the previous pages state and then use it when going back
to that page? Maybe somehow using the viewstate?

Any ideas would be appreciated.

Thanks,

Jeff

Jan 19 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
It is very rare, when you have a series of data pages, that you are not
gathering information about objects that you have, or perhaps should have,
instantiated in the background on the server. These objects model the
business objects that your system is concerned with. The identification of
such objects should have come out in the design phase of your project
development: most people use UML these days.

Assuming that you have such objects, then it is a trivial matter to store
their state when the user performs some appropriate action, such as clicking
on a "Next >" button, or a "Store" button at points where the state needs to
be persisted in a database or on disk. The corollary of this is that if the
user does not perform that action, the state is as it was on leaving the
previous page.

You may also need to store an enumeration value, or some other convenient
device, in the object(s) indicating what the previous page was. This would
be the case where users do not have to travel through the application in any
particular order. You may find it easier to have a separate object that
holds this navigation state information, especially if you want to maintain
a history.

Thus, if you have a "< Back" button (that is a server control), then you can
read any necessary information from the server objects that you have, and
send the user to the required page. That page's Page_Load method can then
read the current state from the relevant objects.

You keep the relevant objects in scope by storing references to them in the
Session.

HTH
Peter
"Jeff" <jt*******@gmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
>I need to place a "Previous Page" link on every page within my site and
a simple javascript:history.back() will not work because I need it to
capture the state of the page when I left it. For example, if I have
a page with some date controls so I can choose a date range and
postback the page. It then displays results based on that date range.
When I leave the page for another page, I would like to have the
Previous Page link take them back to the page with the same date range.

I know I can do this by storing these values in session but it then has
to be specific for every page and store every value manually. Is there
a way to store the previous pages state and then use it when going back
to that page? Maybe somehow using the viewstate?

Any ideas would be appreciated.

Thanks,

Jeff

Jan 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.