Jump to content

Populating a 2nd Dropdownbox from the


LJnel
 Share

Recommended Posts

hey there,Stiil remember my other forum post where i needed to add itemsfrom a dropdownbox to a listbox?? i am still using that example, butnow i want to make it different,i want to selects the items from the 1st dropdownbox and still add them to the listbox below the first dropdownbox, but the items in the first listboxmust be used to fill the 2nd dropdownbox from where i can select again from the filled dropdownbox.. :) thx louis

Link to comment
Share on other sites

Do you want SAME values from the 1st DDL to be displayed in both Listbox and the 2nd DDL, then this is the code....

filename.aspx:<body><form runat=server ID="Form1"><asp:DropDownList ID="ddl" Runat=server><asp:ListItem Value="1">value1</asp:ListItem><asp:ListItem Value="2">value2</asp:ListItem><asp:ListItem Value="3">value3</asp:ListItem><asp:ListItem Value="4">value4</asp:ListItem><asp:ListItem Value="5">value5</asp:ListItem><asp:ListItem Value="6">value6</asp:ListItem></asp:DropDownList><br /><br /><asp:Button ID="btn" Runat=server Text="Submit"></asp:Button><br /><br /><asp:ListBox ID="lb" Runat=server Width="100"></asp:ListBox><asp:DropDownList ID="ddl2" Runat=server></asp:DropDownList></form></body>filename.aspx.vb:Protected Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click        lb.Items.Add(ddl.SelectedItem.Text)        ddl2.Items.Insert(0, ddl.SelectedItem.Text)    End Sub

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...