Click here to Skip to main content
16,016,263 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 3 pages

If I navigate from page 1 to page 2 and then to page 3,

Then I click on the browser back button from page 3

I end up at page 2, can this be done with c# I want to get back to page 3 from page 2 using a command button

I hope this makes sense...
Posted

XML
you can try have a look at "Page.PreviousPage" property

Or the more simple way by using HTML & javascript
<pre lang="text"><a href='javascript:history.go(-1)'>Go Back to Previous Page</a></pre>
 
Share this answer
 
Comments
Member 10906386 11-Dec-14 12:06pm    
Hi Asim, how do I call java-script within c#?
Asim Ghazanfar 11-Dec-14 12:30pm    
protected void MyButton_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "AnotherFunction();", true);
}


For further Refrence:

http://stackoverflow.com/questions/19176086/calling-javascript-function-from-server-side

http://www.webblogsforyou.com/how-to-call-javascript-function-from-code-behind-in-asp-net-c-vb-net/
Asim Ghazanfar 11-Dec-14 12:39pm    
There is another way
string previousURL = ""
if(Request.UrlReferrer != null)
{
previousURL = Request.UrlReferrer.ToString();
}
else
{
previousURL = "No URL referrer";
}
Assuming you are using the WebBrowser control, just call its GoBack method[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900