<html> <head> <script language="VB" runat="server"> Sub Page_Load(sender As Object, e As EventArgs) If Not IsPostBack Then ' Don't want to add items to the list. Dim values as ArrayList= new ArrayList() ' Build up the array ( values ) using the method .ADD DropDown1.DataSource = values DropDown1.DataBind End If End Sub Sub SubmitBtn_Click(sender As Object, e As EventArgs) Label1.Text = "You chose: " + DropDown1.SelectedItem.Text End Sub </script> </head> <body> <h3><font face="Verdana">DataBinding DropDownList</font></h3> <form runat=server> <asp:DropDownList id="DropDown1" runat="server" /> <asp:button Text="Submit" OnClick="SubmitBtn_Click" runat=server/> <p><asp:Label id=Label1 font-name="Verdana" font-size="10pt" runat="server" /> </p> </form> </body> </html>
*Comments are the views of individuals, they may or may not be correct.All comments are reviewed and accepted or rejected.If you give an email address, you will be sent an email when someone makes a comment on this page.*