tags:

views:

122

answers:

2

Hi, I click on items in my listbox and then hit a submit button, but when istep through my button_clicked code it doesn't detect any selectedindex. All controls are in the same form and there are no panels. Why can't I detect what items were clicked on in the listbox? Thanks!

+2  A: 

What about your page load? Maybe you load your listbox in page load and so every time you click the button it loads items again.

NetSide
Doh!..that was it. I wrapped in a "If me.IsPostBack = False then" and now it works great. Thanks!
William
cool, no worries :)
NetSide
A: 

Probably you aren't checking if it is a postback. Only load the listbox if it isn't postback.

Onload(EventArgs e)
{
  If(!IsPostBack)
  {
    //Your code here...
Pedro MM