combo box

Discussion in 'ASP General' started by Eugene Anthony, Jul 20, 2005.

  1. I actually have two combo box on my .asp with the simular code as
    bellow:

    <select name="select2" class="TextField1">
    <%
    openDB()

    set rs = Server.CreateObject("ADODB.Recordset")
    objConn.usp_RetrieveCategories rs

    do while not rs.eof
    response.write "<option value=" & rs(0) & ">" & rs(1)
    rs.movenext
    loop

    closeRS()
    closeDB()
    %>
    </select>


    The stored procedure is as bellow:

    create procedure usp_retrieveCategories
    AS SET NOCOUNT ON

    SELECT CategoryID, CategoryDescription FROM categories

    Return
    GO


    Now I have a table called ProductsCategories:

    create table ProductsCategories
    (
    ItemID int,
    CategoryID int
    );


    I also have the ItemID stored as:

    ItemID = formatforDb(Request.QueryString("ItemID"))


    Now what I intend to do is lets say I have ItemID 1 in
    ProductsCategories table. ItemID 1 can have one or two CategoryID in
    ProductsCategories table. If ItemID 1 has only one CategoryID, then the
    combobox 1 should focus the CategoryID found in ProductsCategories
    table. If suppose ItemID 1 has two CategoryID in ProductsCategories
    table, then the first CategoryID of ProductsCategories table should be
    the focused on combobox1 and the second CategoryID of ProductsCategories
    table should be the focus on combobox2.

    For example:

    <select name="select1" class="TextField1">
    <%
    openDB()

    set rs = Server.CreateObject("ADODB.Recordset")
    objConn.usp_RetrieveCategories rs

    do while not rs.eof
    %>
    <option value='<%=rs(0)%>' <% if rs(0)=Parent then response.write
    "selected" end if %>><% =rs(1) %></option>
    <%
    rs.movenext
    loop

    closeRS()
    closeDB()
    %>
    </select>

    The purpose of the codes above is to modify an existing information
    stored in the database.

    How is it done?. Your help is kindly appreciated.

    Regards

    Eugene Anthony

    *** Sent via Developersdex http://www.developersdex.com ***
     
    Eugene Anthony, Jul 20, 2005
    #1
    1. Advertising

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?QW5nZWw=?=

    COMBO BOX INSTEAD OF DROP DOWN BOX

    =?Utf-8?B?QW5nZWw=?=, Jun 29, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    617
    Ken Cox [Microsoft MVP]
    Jun 29, 2004
  2. Adrian
    Replies:
    1
    Views:
    227
    Bullschmidt
    Feb 18, 2004
  3. dthmtlgod

    Fill Combo Box based on another Combo Box

    dthmtlgod, Nov 16, 2005, in forum: ASP General
    Replies:
    1
    Views:
    595
    Bob Barrows [MVP]
    Nov 16, 2005
  4. Mike

    Combo Box and text box

    Mike, Sep 24, 2003, in forum: Javascript
    Replies:
    2
    Views:
    166
  5. SM
    Replies:
    2
    Views:
    373
Loading...

Share This Page