Populate a Dropdown list based on another one in VB.NET

Hi

I want to be able to populate a drop down list based on the selection of another one or others using vb.net and also pass the value selected to another page or within the same page. for instance one drop down to select a country and a second one to populate the cities based on the first selection. I added one in the code below one below so need to add another one and populate it based on the selection in the first one. I am not using a Database. I just want the selection from the list as it is added manually… Can you please advise of an example on how to achieve this or help exapand the code below . Thanks

       <Script Runat="Server">
Sub Button_Click( s As Object, e As EventArgs )
if IsValid then  
response.redirect ("test.aspx?id=" & countries.Text & " ")
end if
end sub
</script>

    Select a Country <asp:DropDownList ID="countries" runat="server"
    AppendDataBoundItems="true">
    <asp:ListItem>France</asp:ListItem>
     <asp:ListItem>Spain</asp:ListItem>
      <asp:ListItem>USA</asp:ListItem>
       <asp:ListItem>Italy</asp:ListItem>
      <asp:ListItem>England</asp:ListItem>
     </asp:DropDownList>

    <asp:Button ID="Button1" runat="server" Text="Search..." onclick="Button_Click" />
    </form>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.