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

DropDownList.SelectedIndexChanged not working after AutoPostBack

P: n/a
I have 3 related dropdowns. When the 1st is changed, the 2nd is
updated, and when the 2nd is changed, the 3rd is updated.

When i change the 1st dropdown (sites), the SelectedIndexChanged fires
and the 2nd dropdown (spaces) is updated. However, 'spaces' no longer
has a SelectedIndexChanged event. Where did it go to?

If I change 'spaces' (2nd dropdown) before it gets updated by the 1st
(sites), its SelectedIndexChanged is fired and the 3rd list (folders)
is updated. But now 'folders' does not have a SelectedIndexChanged
event! (I don't need it here, but just to show what's going on).

Seems when I rebuild the dropdown on Postback, it is not including the

Anyone any idea what I'm doing wrong?

I've included some of the code below.


private DropDownList sites;
private DropDownList spaces;
private DropDownList folders;

sites = sitesDropDown(url);
spaces = tsDropDown(url);

private DropDownList sitesDropDown(string folderURL)
DropDownList sites = new DropDownList();
sites.SelectedIndexChanged += new EventHandler(sites
sites.AutoPostBack = true;
sites.DataSource = source;
sites.DataTextField = "Name";
sites.DataValueField = "Href";

return sites;

private void sites_SelectedIndexChanged(object sender, EventArgs e)
spaces = tsDropDown(sites.SelectedValue);
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Donal wrote:
spaces = tsDropDown(sites.SelectedValue);

What's tsDropDown and why are you setting your control equal to
whatever's returned by it?

There are 10 kinds of people. Those who understand binary and those who
(Pull the pin to reply)
Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.