Reputation: 225
I'm Creating an asp.net Web Site using C#.
I have a page called Set Event which has some text fields. After filling some of them there is a button that redirects the user to another page. This page has a button that will do some database process and then redirects to the previous page.
After that page processes I want to redirect back to the previous page (Set Event) to fill other text fields.
The question is: when I redirect to the previous page my previous filled data is gone--empty text boxes. Where has my data gone?
Upvotes: 1
Views: 2713
Reputation: 218722
When you redirect it is a new HTTP request. HTTP is stateless. so it wont keep the data you entered earlier there. You should read it from a persistant storage mecahnism and load that to the textboxes. Since you are saving that to the database. You can read that from the database tables and load it there.
Upvotes: 1
Reputation: 23113
You have two options (IMO)
Keep passing the data back and forth from client to server, i.e. hidden fields, viewstate, etc.
save the data in Session, i.e. Session["field1"] = "field1data", or a database, cache, etc.
then recall it on the original page.
Upvotes: 0