M
mkarbarz
Hi,
I have a user control that contains a dropdownlist. I populate the
list in page load event of the user control in the following manner:
if (!IsPostBack) {
_ddUserCity.DataSourceID = "SqlDataSource1";
_ddUserCity.DataTextField = "user_city";
_ddUserCity.DataValueField = "user_city";
_ddUserCity.DataBind();
}
The problem is with the selected index property. The list always
selects the first element on pageload even if it's a postback .
Dropdownlist is autopostback enabled and has view state enabled. I
cannot for the life of me figure out why the selected index is not
being preserved on page postback.
Any help would be appreciated.
Thanks
I have a user control that contains a dropdownlist. I populate the
list in page load event of the user control in the following manner:
if (!IsPostBack) {
_ddUserCity.DataSourceID = "SqlDataSource1";
_ddUserCity.DataTextField = "user_city";
_ddUserCity.DataValueField = "user_city";
_ddUserCity.DataBind();
}
The problem is with the selected index property. The list always
selects the first element on pageload even if it's a postback .
Dropdownlist is autopostback enabled and has view state enabled. I
cannot for the life of me figure out why the selected index is not
being preserved on page postback.
Any help would be appreciated.
Thanks