469,646 Members | 1,558 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

How do I change the current page without loosing state information

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.
Sep 1 '06 #1
1 1482
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/is...0/CuttingEdge/
http://odetocode.com/Articles/440.aspx

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

Owen Richardson wrote:
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.
Sep 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Richard Cornford | last post: by
reply views Thread by Victor Marquez | last post: by
7 posts views Thread by Markus McGee | last post: by
15 posts views Thread by cyndi_r2000 | last post: by
8 posts views Thread by eric | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.