• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

Looking for a way to move back to the previous page in ASP.NET

Hi,

I need a function or a method I could use with a clickable button to move the user back to the previous page, whatever that page maybe - some thing like the back and forward arrows in MS Internet explorer.

Thank you
0
tariqanis
Asked:
tariqanis
  • 3
  • 2
1 Solution
 
aherpsCommented:
this.btnBack.OnClientClick = "javascript:window.history.go(-1);";

Assuming you have a btnBack on the page...
0
 
tariqanisAuthor Commented:
Hi aherps:

I tried your code in the manner below, but the page is posted back to itself.
<asp:ImageButton ID="Phone" runat="server" Width="45pt"
     ImageUrl="~/UploadImages2/phone.jpg" OnClientClick ="javascript:window.history.go(-1);";  />
0
 
tariqanisAuthor Commented:
Hi again aherps:

I found this on the internet and it worked:

OnClientClick="javascript:window.history.back();return false;"
How about a butto that moves to the next (forward) page ?


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
urvinayanCommented:
OnClientClick="javascript:window.history.forward();return false;"
Hope this helps...
0
 
urvinayanCommented:
or
OnClientClick="javascript:window.history.go(1);return false;"
 
0
 
tariqanisAuthor Commented:
Thank you.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now