Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Previous page 1

Status
Not open for further replies.

crazyspree

Programmer
Sep 9, 2004
15
0
0
SE
Hi!

Is there a way for me to but a button on my page that simply goes to the previous page when pressed (after performing various functions)?

something like this:

Private Sub btnAddContact_Click(...) Handles...
Dim previousURL as string
previousURL=[something]

[do stuff]
Response.redirect(previousURL)
End Sub

I'm sure this is very easy, if you know how

Thanks
 
You could use the URLReferrer e.g.
Code:
Response.Redirect(Request.UrlReferrer.ToString)
but bear in mind that this may not always be available (i.e. if the user got to your page by any other method than clicking a link).

Another way would be to use javascript and use the history method e.g.
Code:
<a href="javascript:history.go(-1)"> Go Back </a>

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
tried the Response.Redirect(Request.UrlReferrer.ToString), but it didnt work. i'm using frames.. could that be the problem?
 
Thanks for creating this post. I am having same difficulty.

I created two pages, no frames. The first with a Next button and the second with a back button. When I try to navigate back to the first page from the second page, the Java script works great. The first page is displayed with all of the user settings as they were before the user went to the second page.
However, "Response.Redirect(Request.UrlReferrer.ToString)" does not work in the second page button click event. Also while entering this in the procedure, the "ToString" was not available in the intellisense. I am using Visual Studio 2005.
Any thoughts on what I am doing incorrectly and how to make the back button work without Java?
thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top