SelectedIndexChanged event of a DropDownList sometimes not firing

  • Thread starter Thread starter Lew Barnesson
  • Start date Start date
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
 
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.
 
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
 
Jeff,

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