SelectedIndexChanged event of a DropDownList sometimes not firing

L

Lew Barnesson

Hi All,

I have looked and looked for an answer to the following problem (without
success), and would be very grateful for a solution. The problem:

The SelectedIndexChanged event code of an Asp.Net DropDownList changes text
in an adjacent TextBox by either concatenating SelectedItem.Text (from the
DropDownList) if it is not in the TextBox, or removing it if it is in the
TextBox. This generally works very well.

The problem occurs when I click on the TextBox, and add some text manually.
When I return to the DropDownList (click on the list), the list drops down,
then goes right back up *without* firing the SelectedIndexChanged event. On
the next click, the list again behaves normally (i.e., the list drops down,
and I can select an entry). (But note that if I had just clicked on the
TextBox without adding text and then return to the DropDownList, all goes
well.)

Any advice appreciated....

- Lew
 
J

Jeff Evans

note that if I had just clicked on the TextBox without adding text and
then return to the DropDownList, all goes well.)

This makes me wonder... does the textbox do autopostback when its text is
changed? If so, it would fire and could be messing up your DropDownList
event.
 
L

Lew Barnesson

Jeff,

Thanks. That's the answer! But, I need AutoPostBack on that control, so
guess I'll have to work around it (maybe in Page_Load :) ). -Lew
 
L

Lew Barnesson

Jeff,

Turns out I don't need AutoPostBack for that control. Now all is working.
Thanks for your help! - Lew
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top