Click here to Skip to main content
16,019,614 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
On webform_1, i have some DDL and a Grid. From this webform_1,on some event, i am redirecting user to another webform_2.
Now when i want to return back from webform_2 to webform_1, i want all controls values exactly same what it was having before redirect.
Any solution is appreciated.
Posted
Updated 2-Feb-11 11:30am
v2

1 solution

Remeber that web application are stateless. webform_1 won't be able to remember previous values. You need to save the values. There are many ways of saving the values. The nature and type of the state you want to save will have some infunce as to which mechanism to use. In no particualr order here are some of them.

1. Session State [^]
2. Application[^]
3. Cache[^]
4. Database
5. Cookie[^]

If it is simple you may use session variable

//Set value
Session["MyValue"] =  value;

//Get value
value = Session["MyValue"];


You can pass it to your page as Query String[^] as well.
 
Share this answer
 
v2
Comments
Rohit.Net100 2-Feb-11 18:07pm    
Can we store all Grid data in session. If So How? If Not, Then what is the alternate
AspDotNetDev 2-Feb-11 18:21pm    
Yes, you can store data from your grid in the session. You can store any data in the session. If you are using SQL as your backend to persist session (not common), you must ensure your data is serializable.
Yusuf 2-Feb-11 20:41pm    
Where is your grid data coming from? How did you load your grid initially? Assuming you have used some data storage mechanism, such as DataTable or DataSet, you can put the whole DataTable or DataSet into your Session variable.
Sandeep Mewara 2-Feb-11 23:40pm    
OT: Hey, please don't edit old questions. Suddenly they have popped up in the list without any reason. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900