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

Hitting the Back button does'nt return the previous form the way I lef

Status
Not open for further replies.

rambleon

Programmer
Mar 6, 2004
130
IL
In what state is the previous form returned when I hit the Back button?
In Form1 I have a LinkButton that does the folowing:

Hyperlink1.Visible = False
Textbox1.text = ""
Textbox2.text = ""
Response.Redirect("Form2.aspx")



When I hit the Back button in Form2 Form1 is returned with Hyperlink1 visible and the Textboxes with the original values. How can I get Form1 to return as I left it?
 
is your code in

If Not IsPostBack Then
code
End If

or how are you loading the page?

 
I believe hitting the back button is absolute CACHE.
Meaning, the user is seeing a graphic representation of what was there before.
You kill the back button with JavaScript on preceding page:
<script language="JavaScript">
<!--
javascript:window.history.forward(1);
//-->
</script>

 
As I said in thread855-1144179, my opinion is that using javascript like that to limit what the user can do isn't a very good idea.

One way of making the data disappear when they click the back button is to keep a flag (in a session variable for example) that is set when the user clicks the LinkButton. Then, on page load, check to see if this flag exists. If it does exist then call your function that resets all of the form data.


____________________________________________________________

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