0

I'm working on my first web forms application and I'm running into an interesting problem. I have two pages in my application- one is the main page where the user can manipulate information on the page, and the other is an information retrieval page that lets the user select which information he/she would like to see on the main page. I have a function attached to a button on the main page that immediately uses Server.Transfer to send the browser to my selection page. After the user selects some data, they press another button that uses Server.Transfer to send them back to the main page. I had thought that the flow of the program would return to just below the first transfer call, but it looks like the browser is just reloading the main page in its original state.

The question is as such: how do I make it so that the program flow will return to the place that it left in my function so that I can retrieve information from the previous form and do something with it? Thanks in advance!

Arch
  • 45
  • 2
  • 10
  • 2
    You're running into a problem that is a foundation of web programming. The web is stateless, so when you go to a new page, the code has no knowledge of whether you are coming there fresh or are returning. WebForms has added some state management features like Session and ViewState, but they are bandaids that only help give a simulation of state. If you want to go back to where you were, you need to pass parameters that will allow your page to resume processing based on those parameters. QueryString or Session is the typical path. – Garrison Neely Sep 19 '13 at 20:26
  • I'll look into Session, but my lazier side is telling me to just handle the information loading into the main form with the page_load event depending on a value I get back from PreviousPage. I'm now doubting that there will be a clear cut answer to my question, but I'd still welcome any attempts! – Arch Sep 19 '13 at 20:54

0 Answers0