DropDownList "SelectedIndexChanged" event

G

Greg Smith

I am working on my first web app. The SelectedIndexChanged event for the
DropDownList control doesn't seem to fire when the item is changed.
Obviously there is something more I need to do. Can anybody fill me in?

Any help is greatly appreciated.
 
H

helper of codes

I had the same problem. You need to set the autopostback on the listbox
control parameters. You need to send the page back to the server to
respond to the event.

You would think this would happen automatically with the event but it
doesn't. Apparently it is intended to leave that processing control in
your hands to determine when to cause an autopostback.....

Hope this helps move you on your way....
 
P

Pai

Greg Smith said:
I am working on my first web app. The SelectedIndexChanged event for the
DropDownList control doesn't seem to fire when the item is changed.
Obviously there is something more I need to do. Can anybody fill me in?

Any help is greatly appreciated.

u need to set the AutoPostBack Propoerty of the control to true......
 
G

Greg Smith

I had the same problem. You need to set the autopostback on the listbox
control parameters. You need to send the page back to the server to
respond to the event.

You would think this would happen automatically with the event but it
doesn't. Apparently it is intended to leave that processing control in
your hands to determine when to cause an autopostback.....

Opps! just ran into another problem. I am loading the DropDownList in the
Page_load event. When I click on the control it posts back and fires the
page_load event and I double up on the items listed in the control. If I
put a "Clear" in there first then it looks fine but I have lost my
selection. It is back at an index of 0;

Is there a better way of doing this?
 
M

MSFT

Hi Greg,

You can determine if the the page is postback or not, and then deside if
add the items again. For example:

If not IsPostBack then
...

End If

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top