Populate a second drop down list upon selection value of first drop down list

Discussion in 'JavaScript' started by wonder_gal, May 9, 2007.

  1. #1
    Hi,

    I have 2 drop down lists, and I want to populate the content of the second drop down list according to the selected value from the first drop down list. May I know for VB.NET, how shall I specify that my second drop down list is being populated upon changes of selection from first drop down list? Below is the HTML code for my first drop down list.

    
    <asp:DropDownList id="selCompanyName" style="Z-INDEX: 107; LEFT: 136px; POSITION: absolute; TOP: 32px" runat="server" DataTextField=" Company_Name" DataValueField="GW_Acct_Id" AutoPostBack="True"></asp:DropDownList>
    
    Code (markup):
    Is that I need to add an attribute namely "onSelectedIndexChanged" here?
    And if yes, what if I would like to call a function from VB.NET code-behind upon the selection of the first drop down list? Is it like

    
    <asp:DropDownList id="selCompanyName" style="Z-INDEX: 107; LEFT: 136px; POSITION: absolute; TOP: 32px" runat="server" DataTextField=" Company_Name" DataValueField="GW_Acct_Id" AutoPostBack="True" [B]onSelectedIndexChanged="<%#FunctionName()%>"[/B]></asp:DropDownList>
    
    Code (markup):
    Kindly advice.
    Thanks.
     
    wonder_gal, May 9, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    ajsa52, May 9, 2007 IP