This topic is locked

Multiple Column DropDown

3/11/2009 12:20:08 PM
ASPRunnerPro General questions
H
HilcrRWise author

I am using the following code in an ASP snippet to create a dropdown box that can be used to filter the List page:

categories_list = "<select onchange=""window.location.href=this.options[this.selectedIndex].value;"">"

categories_list = categories_list & "<option value="""">Pupil Name</option>"

str = "Select Surname, FirstName From " strTableName

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection

while not rstmp.eof

categories_list = categories_list & "<option value=""MainPage_list.asp?a=search&value=1&SearchFor=" & rstmp("Surname") & "&SearchOption=Contains&SearchField=Surname"">" & rstmp("Surname") & "</option>"

rstmp.MoveNext

wend

rstmp.close

set rstmp=nothing

Response.write categories_list


This works fine, however it only shows the Surname column and I would like it to show Surname and Firstname data in the same dropdown box, ie:
Currently dropdown box displays as

Jones

Jones

Smith

Smith
and I want it to display as

Jones, James

Jones, John

Smith, James

Smith, John
Is it possible to modify this code to do this, if so how?
Thanks

Sergey Kornilov admin 3/11/2009

I believe you need to modify one line here. See my changes in bold:

categories_list = categories_list & "<option value=""MainPage_list.asp?a=search&value=1&SearchFor=" & rstmp("Surname") & "&SearchOption=Contains&SearchField=Surname"">" & rstmp("Surname") & ", " & rstmp("FirstName") & "</option>"

H
HilcrRWise author 3/12/2009

Worked great.
Thanks