asp and dropdown list with database

Discussion in 'ASP General' started by news, May 3, 2005.

  1. news

    news Guest

    Hello,

    I need help with the following problem:



    An HTML page that have two dropdown list whit different values:

    1. Dropdown list 1(tblname1) =values with different location's. After user
    has selected one value from the dropdown it should show values from
    (tblname2) in the dropdown list2.

    2. When user select an value from dropdown list2(tblname2) and click on a
    button "GO" it should show all the value's from the database that been
    selected in dropdown list1 and 2.



    Please someone please help me out with this problem!?



    Regards,

    Kenneth
     
    news, May 3, 2005
    #1
    1. Advertisements

  2. <select
    onchange="location.href='<%=Request.ServerVariables("SCRIPT_NAME")%>?id='+th
    is.value;">
    <% '' your code that puts in options %>
    </select>

    <%

    iSelectedID = Request.Querystring("id")
    If Not iSelectedID = "" Then
    ''your code to get other values for second box
    sSQL = "SELECT stuff FROM table2 WHERE foreignkey=" & iSelectedID
    End If
    %>
    <select>
    <% 'your code that loops through that second recordset if it was populated
    %>

    For more detailed examples, see here:
    http://www.aspfaq.com/show.asp?id=2270

    Ray at work


    "news" <> wrote in message
    news:OE8Rdo$...
    > Hello,
    >
    > I need help with the following problem:
    >
    >
    >
    > An HTML page that have two dropdown list whit different values:
    >
    > 1. Dropdown list 1(tblname1) =values with different location's. After user
    > has selected one value from the dropdown it should show values from
    > (tblname2) in the dropdown list2.
    >
    > 2. When user select an value from dropdown list2(tblname2) and click on a
    > button "GO" it should show all the value's from the database that been
    > selected in dropdown list1 and 2.
    >
    >
    >
    > Please someone please help me out with this problem!?
    >
    >
    >
    > Regards,
    >
    > Kenneth
    >
    >
     
    Ray Costanzo [MVP], May 3, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWVyZGFhZA==?=

    How to populate dropdown list from database?

    =?Utf-8?B?TWVyZGFhZA==?=, Oct 20, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    10,614
    =?Utf-8?B?TWVyZGFhZA==?=
    Oct 20, 2004
  2. =?Utf-8?B?QnJlbmRlbiBCaXhsZXI=?=

    Dropdown List - Check if value exists in list prior to selection

    =?Utf-8?B?QnJlbmRlbiBCaXhsZXI=?=, Mar 10, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    2,203
    =?Utf-8?B?QnJlbmRlbg==?=
    Mar 20, 2007
  3. =?Utf-8?B?RGF2ZSBU?=

    Columns in Dropdown list and list box

    =?Utf-8?B?RGF2ZSBU?=, Jun 25, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    606
    jufemaiz: jc
    Jun 27, 2007
  4. Replies:
    2
    Views:
    599
  5. mldardy
    Replies:
    1
    Views:
    896
    mldardy
    Dec 10, 2008
  6. M. Craig

    How to set background color of List item in dropdown list

    M. Craig, Nov 12, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    440
    M. Craig
    Nov 12, 2003
  7. M. Craig
    Replies:
    1
    Views:
    934
    Victor Garcia Aprea [MVP]
    Jan 9, 2004
  8. djharrison

    dropdown list and database connection

    djharrison, Sep 25, 2003, in forum: ASP General
    Replies:
    1
    Views:
    204
    Ken Schaefer
    Sep 25, 2003
Loading...