By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,925 Members | 732 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,925 IT Pros & Developers. It's quick & easy.

user control with a dropdown

P: n/a
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

Nov 29 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.