Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 myListBox.SelectedValue doesn t change right away

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-03-08 : 16:49:53
Hi I have a ListBox control in asp.net 2 (it s inside a custom control)
I do this on the server on a save button click:
myListBox.SelectedValue = "my new value"
I see that the code goes executes the instruction above when I hit the Sabe button.
The listbox autopostback is true but when the page is redisplayed the value in the list box remains the same
is there any thing wrong with changing the selected value of the list box using: myListBox.SelectedValue = "my new value"

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-03-08 : 20:51:05
you are not saving the viewstate of the control, or you are resetting the value of the control elsewhere.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-03-08 : 21:00:33
i can see the new value assigned in the code when i m debugging, so i don t see why i should keep the viewsate, do u agree?
Thanks
Go to Top of Page
   

- Advertisement -