468,484 Members | 2,156 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,484 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
SelectedIndexChanged.

Anyone any idea what I'm doing wrong?

I've included some of the code below.

Cheers.

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

//CreateChildControls
sites = sitesDropDown(url);
Controls.Add(sites);
spaces = tsDropDown(url);
Controls.Add(spaces);

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

return sites;
}

private void sites_SelectedIndexChanged(object sender, EventArgs e)
{
spaces = tsDropDown(sites.SelectedValue);
}
Nov 15 '05 #1
1 8612
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
don't.

http://code.acadx.com
(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
reply views Thread by NPC403 | last post: by
reply views Thread by theflame83 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.