Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Appearance

Add a dropdown list box with values for the search

Scroll Prev Next More

 

Add a dropdown list box with specific values.

 

For example, select a car make name from the dropdown list box, and make it so that only the data for the selected car make is displayed.

 

Insert ASP code snippet on the Page Designer screen to do so:

 

dim str, strSQL,rstmp
str = "<select style=""width: 150px; display: inline-block;"" " & _
"class=""form-control"" onchange=""window.location.href=" &  _
"this.options[this.selectedIndex].value;""><option value="""">" & _
"Please select</option>"
 
'select values from the database
strSQL = "SELECT Make FROM Cars"
Set rstmp = CustomQuery(strSQL)
 
while not rstmp.eof
str = str & "<option value='Cars_list.asp?q=(Make~equals~" & _
 rstmp("Make") & ")'>" & rstmp("Make") & "</option>"
rstmp.movenext
wend
 
str = str & "</select>"
Response.Write str

 

See also:

Insert code snippet

About Page Designer

Database API