Listbox SelectedIndexChanged event problems

ronolson111

New member
Joined
May 30, 2003
Messages
2
I am trying to select an entry in my ListBox. When an entry is selected I want to enable a button that will allow me to remove the item. This much works.

The problem: when I try to remove any item in the list, the listbox doesnt report the correct index. It always reports "0". I can flip to the browser and see that item 2 is selected but the code never sees the change.

Is this clear?

Does anyone know whats up here?
 
Select an entry in listbox then remove the item? what are you doing?

"when I try to remove any item in the list, the listbox doesnt report the correct index"? what index you want? since you already removed that item, of course the listbox cannot give you the previous index.... am I misunderstand your problem?

One more question, do you using Web Control or HTML Control? to interact with listbox or combobox, I always prefer the HTML Control rather than Web Control, because Web Control require you to postback in every actions...
 
Can you show us a snippet of your code where you think the problem is occurring?

ListBox.SelectedIndex should work just fine.
 
Thanks for the suggestions- but I resolved it

The code I was using was fine. My understanding of order of events and debugger behavior was not (new to dot net-- still thinking like an asp coder). In short, I found that some code that reset the index was firing *before* the select index changed and button clicked events where I had set my breakpoints. It was counter-intuitive, but true....
 
Back
Top