Go back to the previous page on click of custom Back Button

11,536

Do you want your custom back button to always take the user to the same page as the browser's normal back button will? If so, you can use javascript to do that with something like

myBackButton.OnClientClick = "window.history.go(-1);return false;";
Share:
11,536
Yajuvendra Vant
Author by

Yajuvendra Vant

I heard I Saw I Claim I Own

Updated on June 04, 2022

Comments

  • Yajuvendra Vant
    Yajuvendra Vant almost 2 years

    I am using an image button and on click of it i want to go to visited page. Now i am using - Response.Redirect(Request.UrlReferrer.ToString()), It is going to previous page, but when i am in a page of some user details where the link is looks like - users.aspx?userid=25 and i visit some other page and click back(image button) i want to see the same userdetail page. How to track that. Please Guide.

  • Yajuvendra Vant
    Yajuvendra Vant over 13 years
    No luck. Showing the same page. Actually i have placed that response.redirect in the master page.