ListBox control not being read correctly

G

Guest

I have an ASP.NET page with a ListBox control on it. There are several items in the list created as ListItems then added. When the user clicks "next" to transfer to the next .aspx page a session variable holds the value of the ListItem selected. if the user clicks "back" the ListItem they had previously selected is displayed along with all the other items. If the user chooses a new item in the list and clicks "next" they get the original item displayed and not the new one! The session variable gets updated each time from the displayed items. I've checked the SelectedItemChanges event is firing, but inspecting the value of the selecteditem shows the old value not the new one! If I inspect the Request.Item for the control that is showing the correct value! Does anyone know if this is a bug or what I might be doing wrong?

Thanks

Damon
 
G

Guest

Just some extra info on this. I notice that when the problem occurs the URL is showing the current page and not the previous one. I realise this is a "normal" behaviour of using the server.transfer() call to move between pages, so I need to post the page back twice in order for .NET to sort it self out! Does the server.transfer mean that you can't design Wizards that allow you to go back and forth if you use that mechanism?

Ta

Damon
 
G

Guest

I've managed to fix this issue. There was a variable being re-initialised on both postback and normal page submits.
 

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,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top