sirge — 2011-05-16T23:43:50-04:00 — #1
I wonder why does the dropdownlist always set to index 0. I have a function that dynamically fill the dropdownlist control, now every time that I select an item (example index 5) in the dropdownlist control it always goes to index 0. Can anyone help me. Thanks in advance.
slitheryimp — 2011-05-17T04:11:58-04:00 — #2
are you repopulating the DropDownList on postback? (and is the DropDownList set to AutoPostback?)
sirge — 2011-05-19T09:04:18-04:00 — #3
The said function is just invoke in Page Load. Therefore, I am not repopulating it. Every time I click on the Button it always set to index 0. By the way the DropDownList AutoPostBack property is not set True.
webcosmo — 2011-05-19T10:28:53-04:00 — #4
This usually happens when you have EnableViewState set to false for page and such. Is thats the case you have to explicitly check the previously selected value of the DDL and set that selected on every page load.
Is that the case?
slitheryimp — 2011-05-19T11:06:17-04:00 — #5
The said function is just invoke in Page Load
But are you checking for isPostback before populating the List from Page_Load? (You do realise that Page_Load is invoked with every page request, including postbacks? )