Take the 2-minute tour ×

I am working on a website in ASP.NET and ran into a problem. I want the website to add options to one drop down list when a new option is selected in another drop down list. To do this, I am using the second drop down list's SelectedIndexChanged event. When I test the code by adding this line into this event:


nothing happens to the first drop down list. Is it because this drop down list has the words "Unbound" written in them automatically in the editor? How can I fix this problem?

Here is the markup for the first drop down list, which I want to add items to:

<asp:DropDownList ID="DropDownClasses" runat="server" 

and the second, which I am using the event with:

<asp:DropDownList ID="DropDownSubject" runat="server" 
                <asp:ListItem>Foreign Language</asp:ListItem>
                <asp:ListItem>Social Studies</asp:ListItem>

All help is greatly appreciated.

share|improve this question
what does "Nothing happens to the first drop down list" mean? does it mean that SelectedIndexChanged event is not firing or SelectedIndexChanged is firing but cannot add the item? –  CjCoax Nov 20 '12 at 3:49
please, show markup for both dropdowns –  Igor Nov 20 '12 at 3:53
It appears that neither the event is firing or the item is being added to the drop down list. –  user1594328 Nov 20 '12 at 3:55
add comment

1 Answer

up vote 1 down vote accepted

Details: Sounds like you don't have AutoPostBack set for the first drop down list. Example below

  <asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" 

<asp:DropDownList ID="DropDownList2" runat="server"></asp:DropDownList>

Code Behind

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
share|improve this answer
add comment

Your Answer


