mcauliffe wrote:
Thank you for the reply.
I don't know which one will bew selected until I retrieved a record
from the database. The user is editing a existing record and may
changed the value of the dropdown. I must first indicate the value
is the database.
An example: the database for the column is equal to "Employee" How
do I indicate when I display the ASP page on the form that the
existing value of ordReason is Employee?
Concatenate "checked" into the option value text when building the
option string.
You are building these options by looping through some records in a
recordset, correct? When you get to the one that contains "Employee",
concatenate "selected" (not "checked" - oops) into the option tag.
Obviously, this means you need to know/retrieve the selected value
before building the option list.
Here's a simple example using an array instead of a recordset (since i
don't have access to your database, of course):
<%
dim options, ar, selectedvalue, val
selectedvalue=Request.Form("sel")
ar=array("New","Maint.","Trial","Employee","Beta")
for each val in ar
options=options & "<option value=""" & val & """"
if val=selectedvalue then options=options & " selected"
options=options & ">" & val
next
%>
<html><body><form method="post">
<select name="sel">
<%=options%>
</select><br>
<input type="submit">
</form></body></html>
next
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.