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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Going to previous page with browser’ s back button 1

Status
Not open for further replies.

cesark

Programmer
Dec 20, 2003
621
Hi,

Somebody knows if there is some way to avoid that after several page post backs (for example page2.aspx), if user wants to go back to previous page (say page1.aspx), through browser’ s back button, has to see all previous page2.aspx state after every post back before arriving to page1.aspx? I mean, for example: If user is in page2.aspx and here made several operations (5 post backs), when she/he wants to see previous page1.aspx, does he/she have to see all 5 different states of page2.aspx before arrive to page1.aspx?

For me this is really annoying, since in my pages users makes operations with postbacks, and if user sees the previous state of the page (before doing the operations) he/she may think that she/he is undoing/eliminating the operations.

Thank you,
Cesar
 
The back button does exactly what it is supposed to do as each reload (e.g. the postback) of the page is an item in the browsers history (regardless of whether it is a different page or not).

If you want to provide your user's with a mechanism of going to a certain page then you'll have to either use a hyperlink to that page or redirect them on the click of another control.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Hi ca8msm,

And if the previous page is for paging records, how can I redirect user to the exactly set of records the user was seeing?

And what about SmartNavigation property? Is made for things like this, but I think only works in IE browsers, and use that property can cause a lot of problems according many users:
 
And if the previous page is for paging records, how can I redirect user to the exactly set of records the user was seeing?
If you want to have custom pages (i.e. the same page but different results shown based on a certain criteria) then try using querystring values to show the relevant results. You can then simply update your hyperlink/button to include the relevant querystring values.

And what about SmartNavigation property?
There are lots of issues with smartNavigation which is why I always use my own javascript function to direct people to a particular part of a page.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
So, for example something like this?:

Offers_list.aspx (the page for paging)
Offer_details (the page we are now and we want to return to offers_list.aspx)

In Offer_details.aspx:
Code:
Sub goTo_offers_list(Sender As Object, e As System.EventArgs)
 
  Response.Redirect("offers_list.aspx?" + "Paging_point=" + Request.QueryString(“Paging_point”)

End Sub 


<asp:linkbutton ID=”previous_page" OnClick="goTo_offers_list" runat="server">Return to Offers list</asp:linkbutton>

And in Offers_list.aspx page:
Code:
Sub Page_Load(Sender As Object, E As EventArgs)
 If Not IsPostback Then

  If Request.QueryString(“Paging_point”) <> 0 Then
    
    ‘ Code to query the DB to refill the page (when we come from offers_details.aspx page)

  Else

    ‘ Code to query the DB to fill the page normally

  End If

 End If
End Sub

Is it this your idea? If so, is it not too ‘expensive’ check that ‘If Request.QueryString,…’ every time offers_list.aspx is loaded?

Thanks
 
Yes that's the basic idea, and no I don't think it's too expensive to check whether a querystring variable exists (add tracing to the page and see how long it takes - it will be a very very small amount of time).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 

..Only one important thing. Offer_details.aspx page is accessible from different web addresses in my site (offers_list.aspx, advanced_offers_list.aspx, simple_offers_list.aspx, manage_offers.aspx, etc,...). How I have to do it? I have to create an offer_details.aspx page for every page that is accessible to it? Since when I put the subroutine in the page I only can redirect the page to another page..

 
You could do it a number of ways. The easiest are probably:

1) Pass a querystring to the details page of the calling page
2) Add a session variable of the calling page


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top