Results 1 to 2 of 2

Thread: Populating Combo boxes with 2 values

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    71
    I have a combo box on my ASP that needs to be populated with 2 values.... 1st Value is the ID from a recordset that a stored proc is getting. 2nd value is the description of that ID from the recordset.

    I want the first value to be invisible but be the value that is submitted when I click the submit button on the asp. I want the second value to be visible to the user. How do I do it?

  2. #2
    Guest
    Code:
    <%
    
    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.Open "..."
    
    Set oRS = Server.CreateObject("ADODB.Recordset")
    oRS.Open "SELECT ID, Text FROM Table", oConn
    
    If Not oRS.BOF And Not oRS.EOF Then
      %><select name="listbox"><%
      oRS.MoveFirst
      Do Until oRS.EOF
        %><option value="<%=oRS("ID") %>"><%=oRS("Text") %></option><%
        oRS.MoveNext
      Loop
      %></select><%
    End If
    
    oRS.Close
    Set oRS = Nothing
    
    oConn.Close
    Set oConn = Nothing
    
    %>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width