|
Subject:
|
Fill select box and select recordset value
|
|
Posted By:
|
markd
|
Post Date:
|
2/20/2006 11:59:18 AM
|
Hi,
I have a problem selecting a value from a recordset. The code i have currently populates the select box but i would like to select a value depending on my other recordset.
Its actually an update procedure im doing, but i want to return a recordset in an editable format with select boxes.
<% Set oRs=Server.CreateObject("ADODB.Recordset") strSQL = "SELECT DISTINCT manager FROM tblManager ORDER BY manager" oRs.Open strSQL Do while not oRs.EOF if Request.Form("selmanager") = oRs("manager") then 'if this is the selected one then display as selected Response.Write "<OPTION VALUE = '" & oRS ("manager") & "' SELECTED>" Response.Write oRs("manager") & "</Option>" oRs.MoveNext else Response.Write "<OPTION VALUE = '" & oRs ("manager") & "'>" Response.Write oRs("manager") & "</Option>" oRs.MoveNext end if loop %>
this code fills my select box fine, but im strugling when i want to select a default value.
M Dayton
|
|
Reply By:
|
Steweb
|
Reply Date:
|
2/20/2006 5:41:13 PM
|
... because you take that ( oRs.MoveNext ) behind the condition ?
<% Set oRs=Server.CreateObject("ADODB.Recordset") strSQL = "SELECT DISTINCT manager FROM tblManager ORDER BY manager" oRs.Open strSQL Do while not oRs.EOF if Request.Form("selmanager") = oRs("manager") then 'if this is the selected one then display as selected Response.Write "<OPTION VALUE = '" & oRS ("manager") & "' SELECTED>" Response.Write oRs("manager") & "</Option>" else Response.Write "<OPTION VALUE = '" & oRs ("manager") & "'>" Response.Write oRs("manager") & "</Option>" end if oRs.MoveNext loop %>
Steweb
I don’t Speak English very well, excuse me !
www.steweb.net
|