3
votes

Im using updatepanel in my screen.. i have 2 pages when i click submit button in page1 then it ill be redirect to page2 ....in page2 i have one back button..i wrote click event onclick="history.go(-1)" when i click back it just redirect to page 1 but records already showned in page1 not displayed .how can i sove this problem? cai i use any scriptmanager?

2

2 Answers

4
votes

History.go(-1) is a javascript function that just redirects to the previous page cached in the browser. There is no round trip to the server, the browser just serves the cached page when it first loaded, so form fields were not preserved since you did an AJAX call on the client. The data did not "POST" in the browser, so that is why you see the fields empty.

You can have your submit button to a postback to the server, and handle the redirection there to get the desired outcome. There you will have ViewState preserved, and can load the previous page with data preserved.