470,853 Members | 1,875 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,853 developers. It's quick & easy.

DropDownList.SelectedIndexChanged not working after AutoPostBack

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
1 8760
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.

Similar topics

3 posts views Thread by Tim::.. | last post: by
11 posts views Thread by Santosh | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.