473,395 Members | 1,608 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,395 software developers and data experts.

Back to previous page . . .

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
Nov 17 '05 #1
2 2553
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.

"Lauchlan M" <LM********@Hotmail.com> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
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

Nov 17 '05 #2
> 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
Nov 17 '05 #3

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

Similar topics

8
by: Ralph Freshour | last post by:
Is it possible to inhibit the browser Back/Fwd buttons via PHP? Thanks...
25
by: KK | last post by:
Hi, I am using history.go(-1) for implementing the back button functionality. Its working fine but with this exception. 1. The page which is having back button has some hyperlinks on it. ...
4
by: Bratislav Jevtic | last post by:
hi, ASP.NET, framework 1.0, patch 2, Windows 2000 server is this possible: from server side to say "go back" to browser? ------------------- scenario: I've got some page with a list. When...
8
by: moondaddy | last post by:
Is there a way to make the browser move back to the previous page via code behind on the server? The effect would be the same as the user clicking on the browser's back button. Thanks. --...
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
6
by: Nad | last post by:
Hello, In order to go back to the previous page from a page with possible postbacks I keep Request.Referrer in ViewState and then use it to redirect to the previous page. However I am losing all...
1
by: Oscar Madrid | last post by:
Hi.. Mi aspx use many controls, then click "next" and i got a "Preconfirmation Page", if the user needs to correct a mistake, there is a "Back Button" in mi aspx, wich must go back to the previous...
2
by: monomaniac21 | last post by:
hi all im trying to write a pdf document which contains two columns of data. when the column on the left crosses over to the next page i need to be able to go back afterwards to the previous...
8
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I the page knows there was a cross post back. but i can not find the control. (asp.net 3.5) calling page has a master calling control: <asp:Button ID="btnSendAlert" runat="server" Text="Go"...
2
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm reying to get around the problem of cross page post back. I'm attempting to use an interface to cast the previous page. if (PreviousPage != null) { ICommonPostback frm = PreviousPage as...
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:
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.