473,480 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1643
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2584
by: Richard Cornford | last post by:
For the last couple of months I have been trying to get the next round of updates to the FAQ underway and been being thwarted by a heavy workload (the project I am working on has to be finished an...
0
1192
by: Victor Marquez | last post by:
Hi All, We have been experiencing problems with StateServer. The service is hanging-up and stops responding further requests. Facts: - There are not events in Application Logs (not...
7
1660
by: Markus McGee | last post by:
Hi all, I have a quick question...I believe. On my web page, call it page A, I have a drop downlist with runat server enabled. When the drop downlist change event occurs it repopulates a...
9
3896
by: Edge | last post by:
hi, I am saving the user selected culture in a session variable so I can apply it back to all pages when refreshed and then load the proper .resx values. For that I am using global.asax
41
2468
by: Petr Jakes | last post by:
Hello, I am trying to study/understand OOP principles using Python. I have found following code http://tinyurl.com/a4zkn about FSM (finite state machine) on this list, which looks quite useful for...
15
1792
by: cyndi_r2000 | last post by:
Hi Everyone: I have a web application running on .NET 2.0 under IIS 6.0 and users of this application seem to be loosing their session randomly - we havent been able to identify any pattern,...
0
1407
by: jobs | last post by:
I have a page where users select from a bunch of gridviews, setting session variables and then hit an a New or Edit button which redirects them to a formview in edit or insert mode. While in...
3
8688
by: Nathan Sokalski | last post by:
I am recieving the following error on the second postback of a page I have written: The state information is invalid for this page and might be corrupted Stack Trace: ...
8
996
by: eric | last post by:
I have a 2.0 asp.net project. In a class contained within a seperate project, I am trying to reference HttpContext.Current.Session but Session is always null. I've tried implementing...
0
7048
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6911
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7050
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7091
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4787
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.