|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dynamic listbox/jump trouble
I am trying to build a dynamic listbox that will load a page when the user selects something. The url that I want to load is competitors.asp?company= and the company that they selected would be part of the querystring. I have gotten the listbox to dynamically load live data, but cannot get it to fire the event that loads the url. Any ideas?
Thanks, Nathan <% ' Create the MyConnection Object and Open the connection to the database using your DSN Set MyConnection = Server.Createobject("Adodb.Connection") MyConnection.open "DSN=competitors" ' Selection Box Response.write "<Select name=Myselectbox><option value="""">Please Select</option>" 'Write your Query MyQuery = "Select company from tblCompany WHERE DirectCompetitor = -1" 'Execute your Query using MyConnection Set Myrs = MyConnection.Execute(MyQuery) 'Loop until the End of Myrs Do Until Myrs.eof 'Add all cities till the end of Myrs Response.write "<option value>" & left(myrs("company"),20)&"</option>" 'Move to the next record Myrs.movenext loop 'Close the Selection box Response.write "</select>" 'Close the recordset Myrs.close Set Myrs = nothing 'Close the Connection MyConnection.close Set MyConnection = Nothing %> |
|
#2
|
|||
|
|||
|
There are two events, both with problems: onClick will execute after you clicked on the box but every time you click on it; onChange will execute once the content of the box changes. The pb is that you need to have a dummy "Please select an item" otherwise content will not change for the first item in the list
|
|
#3
|
|||
|
|||
|
Thank you, I have gotten it to work.
Take care, nat |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Dynamic listbox/jump trouble |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|