473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 9053
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
7
by: Daniel | last post by:
Is there any other way can override this event, like javascript onchange added to the attribute of this dropdownlist? Thanks
5
by: bryanp10 | last post by:
I have a page that is almost entirely dynamically created. Textboxes and checkbox are working fine, firing events, and persistent their state. DropDownList is giving me a major headache. All...
2
by: rt | last post by:
hi, iam a having a datagrid, pls check the code ---- Public WithEvents bgt As System.Web.UI.WebControls.DropDownList ---
3
by: Tim::.. | last post by:
Hi... Can someone please tell me what I'm doing wrong here... I have a dropdownmenu populated from a database! The idea is that a user selects an option from the dropdownlist which then loads...
11
by: Santosh | last post by:
Dear all , i am writting following code. if(Page.IsPostBack==false) { try { BindSectionDropDownlist();
0
by: stretch73 | last post by:
I have a repeater control with a DropDownList in the header template. I am trying to make a database call and sort the results by the selectedIndex property of the drop down. The...
5
by: revbart | last post by:
Yep, that's me. I'll bet I've read a hundred articles somewhere or another, but I just can't get the thing to work. I'm working on a custom solution. One of the major UIs includes a calendar-style...
6
by: shashi shekhar singh | last post by:
Respected Sir, I have to create multiple dynamic dropdownlist boxes and add items dynamically in <asp:table> server control but problem occurs , i.e. except of fist dropdown list no dropdownlist...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.