PDA

Click to See Complete Forum and Search --> : Populating Combo boxes with 2 values


VBDever
Feb 27th, 2001, 07:32 AM
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?

Feb 27th, 2001, 08:40 AM
<%

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

%>