469,578 Members | 1,523 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Javascript label change with browser back button

Hello.

I have an aspx page that changes an HTML label's text using
javascript.

After the label's text has been changed in this way, I redirect to
another aspx page.

If I then use the back button on the browser, the label has lost it's
newly changed value.

Do you know how I can make sure that the label doesn't lose it's
changed value when I click the back button?

TIA.

-dnw.
Nov 18 '05 #1
3 2208
You want to make sure your page is not cached.
When the back button is clicked you want your page to be requested from the
server again so you can ensure the correct label is output.
By disabling caching for your page, this should solve the problem in most
cases.
Try some code like this:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Dot net work" <do***@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
Hello.

I have an aspx page that changes an HTML label's text using
javascript.

After the label's text has been changed in this way, I redirect to
another aspx page.

If I then use the back button on the browser, the label has lost it's
newly changed value.

Do you know how I can make sure that the label doesn't lose it's
changed value when I click the back button?

TIA.

-dnw.

Nov 18 '05 #2
Hi,

Sorry, but I think this is the opposite of what my question asked for.

If a label gets changed using javascript, and then the user redirects
somewhere else, if the user then clicks the back button on the browser
bar, I need the label to display/remember the *new* value, and not be
reset back to the original value.

Thanks,
-dnw.

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message news:<ec**************@tk2msftngp13.phx.gbl>...
You want to make sure your page is not cached.
When the back button is clicked you want your page to be requested from the
server again so you can ensure the correct label is output.
By disabling caching for your page, this should solve the problem in most
cases.
Try some code like this:

Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Dot net work" <do***@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
Hello.

I have an aspx page that changes an HTML label's text using
javascript.

After the label's text has been changed in this way, I redirect to
another aspx page.

If I then use the back button on the browser, the label has lost it's
newly changed value.

Do you know how I can make sure that the label doesn't lose it's
changed value when I click the back button?

TIA.

-dnw.

Nov 18 '05 #3
I needed to use a session cookie.
-dnw.

do***@hotmail.com (Dot net work) wrote in message news:<77*************************@posting.google.c om>...
Hello.

I have an aspx page that changes an HTML label's text using
javascript.

After the label's text has been changed in this way, I redirect to
another aspx page.

If I then use the back button on the browser, the label has lost it's
newly changed value.

Do you know how I can make sure that the label doesn't lose it's
changed value when I click the back button?

TIA.

-dnw.

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.