You can make the ViewState of a control to true. By default its false.
Hi,
You can use the Request.UrlReferrer method, but you need to store the original UrlReferrer in viewstate otherwise the form will just redirect back to itself.
If Not Page.IsPostBack Then
ViewState("ReferrerUrl") = Request.UrlReferrer.ToString()
End IfThen you can use it with an image back button like;
Private Sub ImgBack_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs)
Response.Redirect(ViewState("ReferrerUrl").ToString())
End Subor at the end of any other sub
HTH
RG
Hi,
I have check the buy.com for this problem, thay are not using asp.net .
I think they are using JavaScript (Window.History) to perform this function.
Hey hbcontract,
so if I use the back button on your cart, where does IE point the browser to? Does it point to a cashed version of the previous page? If it does, then the code does not get executed on the prev page and room for errors opens up. How did you handle that situation?
Hey BhatiaWorld, you are prob right, will check the code on buy.com (but they prob include a js file).
Thanks for the responses everyone, try a solution based on your feedback.
Kommi
Actually, i just looked at the code and saw that Buy.com uses cookies to store what is in the shopping cart. Still dont understand how the cashed previous page is corrected with the contents of the shopping cart.
Hi, I used this and it worked fine, until I used a button to redirect to the new page rather than a hyperlink. Now, it does not know what page it was previously on when it gets to
ViewState("UrlReferrer") = Request.UrlReferrer.ToString()Any way around this? Can I use the javascript (window.history) and how does that work?
Thanks for any help!
Greg
I used server.transfer rather that response.redirect and it worked fine.
0 comments:
Post a Comment