473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Return to previous page

I use javascript:history.go(-1) to return to the previous page.

I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost. How can these
be kept when returning?

I'm very grateful for fast response.

// S
Jun 27 '08 #1
13 9554
On 15 May, 07:10, sta...@gmail.com wrote:
I use javascript:history.go(-1) to return to the previous page.

I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost. How can these
be kept when returning?

I'm very grateful for fast response.

// S
The previous data is lost because the browser has no way of retaining
it.

You have to use postback events to do the redirection and store the
data in session state.

Jun 27 '08 #2
Hello Staeri

How do you return to the last Page?
If with "history.go(1);, all should work as expected,
because you are only navigating on the browser history.

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
Jun 27 '08 #3
"Peter Bucher [MVP]" <pe**********@aspnetzone.dewrote in message
news:07**********************************@microsof t.com...
How do you return to the last Page?
If with "history.go(1);, all should work as expected,
because you are only navigating on the browser history.
Clearly, that won't do what the OP wants, because that will simply open the
previous page as it was previously opened... Changes to DropDownLists,
TextBoxes etc will not be "remembered" because ASP.NET has no way of
"remembering" them unless as a result of a postback...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #4
<st****@gmail.comwrote in message
news:3e**********************************@56g2000h sm.googlegroups.com...
>I use javascript:history.go(-1) to return to the previous page.
I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost.
Obviously. When you hit the Back button (either directly or in the above
code), the browser opens the previous page in exactly the same way as it was
previously opened - it has no way of "remembering" any client-side
modifications made to that page unless they were posted back...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #5
On 15 Maj, 10:15, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
<sta...@gmail.comwrote in message

news:3e**********************************@56g2000h sm.googlegroups.com...
I use javascript:history.go(-1) to return to the previous page.
I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost.

Obviously. When you hit the Back button (either directly or in the above
code), the browser opens the previous page in exactly the same way as it was
previously opened - it has no way of "remembering" any client-side
modifications made to that page unless they were posted back...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
Thank you for the answers!

I've stored the dropdownlist selections in sessions but is there a way
to set the dropdownlist selections to the session values when the page
is showed again when clicking the return button with
javascript:history.go(-1)? If it can be made without changing the url
I'm very happy because otherwise there are a lot changes I have to
make because of iframe etc.

// S
Jun 27 '08 #6
Sure. You just need to restore selection from the session in the Page_Load
event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<st****@gmail.comwrote in message
news:91**********************************@34g2000h sh.googlegroups.com...
On 15 Maj, 10:15, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
><sta...@gmail.comwrote in message

news:3e**********************************@56g2000 hsm.googlegroups.com...
>I use javascript:history.go(-1) to return to the previous page.
I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost.

Obviously. When you hit the Back button (either directly or in the above
code), the browser opens the previous page in exactly the same way as it
was
previously opened - it has no way of "remembering" any client-side
modifications made to that page unless they were posted back...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net

Thank you for the answers!

I've stored the dropdownlist selections in sessions but is there a way
to set the dropdownlist selections to the session values when the page
is showed again when clicking the return button with
javascript:history.go(-1)? If it can be made without changing the url
I'm very happy because otherwise there are a lot changes I have to
make because of iframe etc.

// S

Jun 27 '08 #7
On 15 Maj, 11:18, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Sure. You just need to restore selection from the session in the Page_Load
event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

<sta...@gmail.comwrote in message

news:91**********************************@34g2000h sh.googlegroups.com...
On 15 Maj, 10:15, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
<sta...@gmail.comwrote in message
>news:3e**********************************@56g2000 hsm.googlegroups.com...
I use javascript:history.go(-1) to return to the previous page.
I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost.
Obviously. When you hit the Back button (either directly or in the above
code), the browser opens the previous page in exactly the same way as it
was
previously opened - it has no way of "remembering" any client-side
modifications made to that page unless they were posted back...
--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
Thank you for the answers!
I've stored the dropdownlist selections in sessions but is there a way
to set the dropdownlist selections to the session values when the page
is showed again when clicking the return button with
javascript:history.go(-1)? If it can be made without changing the url
I'm very happy because otherwise there are a lot changes I have to
make because of iframe etc.
// S- Dölj citerad text -

- Visa citerad text -
It looks like Page_Load isn't fired when returning to the page by
using javascript:history.go(-1). Is that correct?

// S
Jun 27 '08 #8
This means the browser gets it from the cache. location.reload(true) will
always go to the server. You need to think how to combine both history and
location calls.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<st****@gmail.comwrote in message
news:12**********************************@2g2000hs n.googlegroups.com...
On 15 Maj, 11:18, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Sure. You just need to restore selection from the session in the Page_Load
event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

<sta...@gmail.comwrote in message

news:91**********************************@34g2000h sh.googlegroups.com...
On 15 Maj, 10:15, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
<sta...@gmail.comwrote in message
>news:3e**********************************@56g2000 hsm.googlegroups.com...
I use javascript:history.go(-1) to return to the previous page.
I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost.
Obviously. When you hit the Back button (either directly or in the
above
code), the browser opens the previous page in exactly the same way as
it
was
previously opened - it has no way of "remembering" any client-side
modifications made to that page unless they were posted back...
--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
Thank you for the answers!
I've stored the dropdownlist selections in sessions but is there a way
to set the dropdownlist selections to the session values when the page
is showed again when clicking the return button with
javascript:history.go(-1)? If it can be made without changing the url
I'm very happy because otherwise there are a lot changes I have to
make because of iframe etc.
// S- Dölj citerad text -

- Visa citerad text -
It looks like Page_Load isn't fired when returning to the page by
using javascript:history.go(-1). Is that correct?

// S
Jun 27 '08 #9
<st****@gmail.comwrote in message
news:91**********************************@34g2000h sh.googlegroups.com...
I've stored the dropdownlist selections in sessions
Ah - you didn't mention that in your original post...
but is there a way to set the dropdownlist selections to the session
values
when the page is showed again when clicking the return button with
javascript:history.go(-1)? If it can be made without changing the url
I'm very happy because otherwise there are a lot changes I have to
make because of iframe etc.
iframe? You didn't mention that either in your original post...

Anyway, as I see you've already discovered, session won't help you here
because the page is being fetched from cache. Therefore, you'll need to find
some way of preventing this which, depending on how you've set your app up,
will be either fairly trivial or next to impossible:

http://www.google.co.uk/search?hl=en...ge+cache&meta=
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jun 27 '08 #10
What is the purpose of using the back button ?

The intended use is to display the previous page as it was previously seen
by the user. You could also prevent this page from being cached browser side
so that it is fetched again from the server (and possibly then updated).

Or perhaps should you implemnt your own link. What is the meaning of using
the back button in your case ?

--
Patrice

<st****@gmail.coma écrit dans le message de groupe de discussion :
3e**********************************...oglegroups.com...
I use javascript:history.go(-1) to return to the previous page.

I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost. How can these
be kept when returning?

I'm very grateful for fast response.

// S

Jun 27 '08 #11
On 15 Maj, 13:20, "Patrice" <http://www.chez.com/scribe/wrote:
What is the purpose of using the back button ?

The intended use is to display the previous page as it was previously seen
by the user. You could also prevent this page from being cached browser side
so that it is fetched again from the server (and possibly then updated).

Or perhaps should you implemnt your own link. What is the meaning of using
the back button in your case ?

--
Patrice

<sta...@gmail.coma écrit dans le message de groupe de discussion :
3e5837d1-08a6-4ceb-8b48-1bb0afc2a...@56g2000hsm.googlegroups.com...
I use javascript:history.go(-1) to return to the previous page.
I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost. How can these
be kept when returning?
I'm very grateful for fast response.
// S- Dölj citerad text -

- Visa citerad text -
The purpose of the back button is to display the previous page as it
was previously seen by the user. How I go back to the previous page
doesn't matter as long as the url isn't changed.

// S
Jun 27 '08 #12
On 15 May, 17:22, sta...@gmail.com wrote:
On 15 Maj, 13:20, "Patrice" <http://www.chez.com/scribe/wrote:


What is the purpose of using the back button ?
The intended use is to display the previous page as it was previously seen
by the user. You could also prevent this page from being cached browser side
so that it is fetched again from the server (and possibly then updated).
Or perhaps should you implemnt your own link. What is the meaning of using
the back button in your case ?
--
Patrice
<sta...@gmail.coma écrit dans le message de groupe de discussion :
3e5837d1-08a6-4ceb-8b48-1bb0afc2a...@56g2000hsm.googlegroups.com...
I use javascript:history.go(-1) to return to the previous page.
I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost. How can these
be kept when returning?
I'm very grateful for fast response.
// S- Dölj citerad text -
- Visa citerad text -

The purpose of the back button is to display the previous page as it
was previously seen by the user. How I go back to the previous page
doesn't matter as long as the url isn't changed.

// S- Hide quoted text -

- Show quoted text -
There is another approach to this that might be helpful.

Your problem seems to be that you are going away from the first page
when the user initiates a request for the second page. Hence the
browser reloads the first from scratch when you return to it (either
from the local cache or from the server but will make no difference).

Session state can be used to overcome this but an easier solution is
to use a single page with a MultiView control with two Views (one view
for each formerly separate page). That way ViewSate will retain the
content of any web server controls in both views because switching
between then will only occur on postback (but use a postback command
button to do the going back not one that does it via the browser using
JavaScript).

HTH
Jun 27 '08 #13
On 15 Maj, 19:26, Stan <googles...@philhall.netwrote:
On 15 May, 17:22, sta...@gmail.com wrote:


On 15 Maj, 13:20, "Patrice" <http://www.chez.com/scribe/wrote:
What is the purpose of using the back button ?
The intended use is to display the previous page as it was previously seen
by the user. You could also prevent this page from being cached browser side
so that it is fetched again from the server (and possibly then updated).
Or perhaps should you implemnt your own link. What is the meaning of using
the back button in your case ?
--
Patrice
<sta...@gmail.coma écrit dans le message de groupe de discussion :
3e5837d1-08a6-4ceb-8b48-1bb0afc2a...@56g2000hsm.googlegroups.com...
I use javascript:history.go(-1) to return to the previous page.
I've now found out that when returning to the previous page all
selections that the user made in dropdownlists are lost. How can these
be kept when returning?
I'm very grateful for fast response.
// S- Dölj citerad text -
- Visa citerad text -
The purpose of the back button is to display the previous page as it
was previously seen by the user. How I go back to the previous page
doesn't matter as long as the url isn't changed.
// S- Hide quoted text -
- Show quoted text -

There is another approach to this that might be helpful.

Your problem seems to be that you are going away from the first page
when the user initiates a request for the second page. Hence the
browser reloads the first from scratch when you return to it (either
from the local cache or from the server but will make no difference).

Session state can be used to overcome this but an easier solution is
to use a single page with a MultiView control with two Views (one view
for each formerly separate page). That way ViewSate will retain the
content of any web server controls in both views because switching
between then will only occur on postback (but use a postback command
button to do the going back not one that does it via the browser using
JavaScript).

HTH- Dölj citerad text -

- Visa citerad text -
Thank you for the suggestion, Stan! Will there be any performance
degradation when using a MultiView? Will both views be loaded
initially or only the first view?

// S
Jun 27 '08 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Marcel | last post by:
Hello, I'm working on a search application for my website. The website contains a lot of pictures, and a search should return clickable thumbnails. No problems there. My problem started when I...
4
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
1
by: Símun D. Simonsen | last post by:
Hi, Hope somebody can help. After calling a new form, from a link in a record, shown in a datagrid, set up with paging, how can I return to the previous page with the datagrid opened with the...
3
by: venky | last post by:
Hi, I have a question regarding page navigation. See i have a page called page1.aspx and page2.aspx. On some event in the both the pages the page get transfered to page3.aspx using...
1
by: sri_san | last post by:
Hello, I am working on a website where I need to navigate to the previous page once the user clicks on "back" button. I store the previous page from the "HTTP_REFERER" Server variable and the...
2
by: wiewiek | last post by:
Is there a way to go back to the previous page when a button (Cancel button) is hot? It's an ASP control. Thanks
1
by: staeri | last post by:
I want to place a return to previous page-link which returns to the previous page without reloading it. The reason I don't want to reload the page is that in the Page_load there is a web service...
1
by: Jeff | last post by:
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...
3
by: md9108 | last post by:
I have a previous page and next page coded. The next page works. The previous page gives me an http: 404 error and I can't figure it out. The error is on the line "<td align=left> <!-- ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.