Back to previous page . . .

  • Thread starter Thread starter Lauchlan M
  • Start date Start date
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
 
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.
 
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
 
Back
Top