jleone
01-08-2007, 08:23 PM
Hi all -
I am having a problem with trying to get the selected index from my listbox. I want to remove a name from a listbox (as well as from my DB table) when I click a button. The problem is that the selected index is always -1 until after a postback. This is different than the behavior on a windows application form which will immediately give the selected index in the selectedindexchanged event.
I have tried redirecting to my same page on the button click to get the selected index value and then trying to call a sub in a certain event "after" the selected index has been set (i.e. LoadComplete, PreRenderComplete), but nothing is working out for me.
Any suggestions on how to get that selected index after clicking my "Remove" button?
I am having a problem with trying to get the selected index from my listbox. I want to remove a name from a listbox (as well as from my DB table) when I click a button. The problem is that the selected index is always -1 until after a postback. This is different than the behavior on a windows application form which will immediately give the selected index in the selectedindexchanged event.
I have tried redirecting to my same page on the button click to get the selected index value and then trying to call a sub in a certain event "after" the selected index has been set (i.e. LoadComplete, PreRenderComplete), but nothing is working out for me.
Any suggestions on how to get that selected index after clicking my "Remove" button?