Set SelectedValue on ListBox
Posted on 2004-09-01
I have a listbox on my webpage that has a couple of hundred client names in it. I store the last selected client name from this listbox in the Session. This same listbox is available on a number of pages, so I want to have the listbox show this previously selected client name. So, for example, I use: lb.SelectedValue = mySessionValue when I bind the data to the listbox, which works, but the listbox does not "scroll down" to show this selected client's name. If I scroll down to the client, they are indeed selected, but this seems counter-intuitive. Is this a bug/feature, or is there a way to have the listbox "scroll" itself to the selected item?
I can post my code, if you like, but this seems to me like something weird is going on with the listbox...