This is a migrated thread and some comments may be shown as answers.

[Solved] Postback event not firing

1 Answer 144 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jamie Shedley
Top achievements
Rank 1
Jamie Shedley asked on 21 Oct 2009, 11:31 AM
I have created a ComboBox on a page and I am adding the SelectedIndexChanged event handler via code in the page load event. When I dynamically add an item to the ComboBox and select the new Item during the adding process I would expect the SelectedIndexChanged event to fire. The AutoPostBack property is set to true and only one item exists in the ComboBox.

Please could someone tell me if I am doing something stupid or if this is a bug with the control.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 21 Oct 2009, 12:06 PM
Hello Jamie,

The selectedIndexChanged event only fires when the selected index actually changes. You cannot change the selected index if there is only one item in the list. But by adding another item to your combobox,.you will force the user to make a decision and your selectedIndexChanged event will fire.

Princy.
Tags
ComboBox
Asked by
Jamie Shedley
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or