Back to previous page . . .

L

Lauchlan M

Hi.

I'd like to put a button on my ASP.NET pages that sends them back to the
previous page (as opposed to them having to use the browser back button).

I can think of two ways to do this:

(i) Use Javascript "window.history.back();" function

(ii) Harcode the back button as a link button pointing to a page where I
know it came from (due to the architecture of the site).

Firstly, where would I code this javascript in ASP.net? Should I do it from
the design view HTML tab, or somehow attach it to an event handler for the
button? I am assuming the first, a code example would be handy . . .!

Second, Doing it with javascript probably wont fly for this app, as I have
to support PDAs, and this requires HTML 3.2 which doesn't have Javascript.
So I guess I have to go with the second option . . .

But the second option loses the history on the page it came from.

Any suggestions?

Lauchlan M
 
K

Kevin Spencer

The problem with the JavaScript solution is that ASP.Net pages Post Back to
themselves. You can never be certain WHERE the "back()' function is going to
take you, and of course, you will get those "This page must be reloaded"
messages in your browser. It would be better to keep track on the server of
what the last page viewed was, and use that.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.
 
L

Lauchlan M

The problem with the JavaScript solution is that ASP.Net pages Post Back
to
themselves. You can never be certain WHERE the "back()' function is going to
take you, and of course, you will get those "This page must be reloaded"
messages in your browser. It would be better to keep track on the server of
what the last page viewed was, and use that.

Ta
 

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top