Add a Link Button to Navigate Previous Page

In my Asp.Net web page, I had a trouble with navigating to the previous URL. I guess possibly because of postback, my linkbutton was navigating to the current page when I use this method:

Response.Redirect(Request["HTTP_REFERER"]);

I was unable to give previous page’s URL as a link simply, because there were a lot of data so it always was taking a while when I “navigated to the last page” with this method.

Then I saw this great JavaScript method and it works perfectly so far. All you have to do is to insert a Asp:LinkButton then add this to your Page_Load event:

lnkBtnPreviousPage.Attributes.Add("onClick", "javascript:history.back(); return false;");
Post a comment