Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Combo Boxes in InterDev ASP pages

Status
Not open for further replies.

jms1885

Technical User
Feb 27, 2002
9
US
I'm working in interdev creating ASP pages. I've created forms that will interface with a SQL database but I can't figure out how to create a combobox. The combobox is needed so that a user could enter a new name or select one from the list. Drop-down lists simply don't have the functionality that I need, does anyone know how to create a combobox?
 
I have ran into one problem with this control. If the control has focus and then you click a button, you have to click the button twice for it to work.
 
Is there a way to allow users to use the Backspace key with this control?
 
The backspace works in the two pages I am using the control in. I did notice if you have a combo with numbers( say 10000 to 19000) that the backspace only highlights the number. I am not sure that it is a bad thing.

 
Adding/using a ListboxDTC to do comboboxes is pretty easy. Honest. And it gives a handy object model for traversing the list, adding in extra items etc.

Add a database connection via the Global.ASA (right click it!)
Add a recordset DTC to your page. Put in parameters as question marks (?) in the where clause. And test it. Set the recordset to NOT auto-open (third tab) if it has parameters.
Add a listboxDTC, pick the recordset, and the two columns on the SECOND parameter tab.
Add a PageObjectDTC. This makes life a tiny bit easier.

You can now add a function that runs each time the page opens:

Sub thisPage_onenter()
if thisPage.firstEntered then
'page initialisation
'populate combo boxes...
' passing in any parameters...
'rsList.setParameter 0, "a value"
rsList.open
'combo box will now be populated, so rs can be closed
rsList.close
'add any additional items...
cmbMyCombo.addItem '<please select>', -1, -1
end if
end sub

The item list is only fetched once from the database, and is cached as a hidden field on the page - so you only need to open the recordset once.

If you need to refresh the combo-list then you must clear the list first (cmbMyCombo.clear) before re-opening the recordset.

The (Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top