This topic is locked

dropdown menu for easy search

10/2/2004 6:03:44 PM
ASPRunnerPro General questions
M
merriamdesign author

I want to add a drop down menu of a list of values (from the database) to a list page. Is there an easy way of doing this? I tried coping the code of the same drop down menu from the edit/add page and had some issues getting it to work. Any help?
Cheers!
Chris

Sergey Kornilov admin 10/6/2004

Chris,
here is the sample code that you can use:
strSQL = "select ID, Name from TableName"

rsTemp.open strSQL, dbConnection

if not rsTemp.EOF then

  Response.Write "<select size = " & strSize & " name=""" & strName & """>"

  Response.Write "<option value="""">Please select</option>"

  while not rsTemp.Eof

  Response.Write "<option value=""" & rsTemp(0) & """>" & rsTemp(1) & "</option>"

  rsTemp.MoveNext

wend
Response.Write "</select>"
rsTemp.Close

set rsTemp = Nothing

M
merriamdesign author 10/8/2004

Thanks for the code... I am not sure where to put it though. Do I insert it in the search form. Sorry to be so dumb about this stuff... I am a designer, trying to be a developer.
thanks again