How do I change the current page without loosing state information

G

Guest

I have an asp.net website where i have a quick search facility built into my
master page. the search is a web control, with a drop down country box and a
list box full of cities.

When i select my country my citylist is refreshed ok. I want to be able to
then click on my city and jump to a specific page without loosing state; and
i dont know how.

Currently My change event on my city listbox does a
response.redirect("detail.aspx?id="+id); and it correctly displays the new
page but my country/city information are reset back to their defaults; how do
i prevent this? is there a way i can change the page within my city listbox
without loosing the state information for the whole control??

Many Thanks
Owen.
 
O

offwhite

You can always use the Session object.

string city = Session["city"];

Session["city"] = ListBox1.SelectedValue;

You can also use the new ASP.NET 2.0 Profile. It allows you to
remember the value set by the user for when they return days later.
The session will expire 30 minutes after they leave the website.

Here are a couple of useful links for the profiles.

http://msdn.microsoft.com/msdnmag/issues/05/10/CuttingEdge/
http://odetocode.com/Articles/440.aspx

Brennan Stehling
http://brennan.offwhite.net/blog/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top