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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box with two columns

Status
Not open for further replies.

MDA

Technical User
Jan 16, 2001
243
US
Hi all,

I have an asp page that utilizes a combo box connected to a database. Currently the combo box pulls in a "code" related to a table in a database. However, I want to know if it is possible to show the corresponding description in the box, when the drop-down is “showing”?

So for instance, when I click on the combo box the drop down list shows all codes with descriptions next to each code. However, after selecting the code, only the value (Code) is populated into the text area of the combo box.

Is this possible?

Thanks,
MDA
 
Do you mean of my code? or of how it should look? The code is quite extensive and actually is currently in Jscript... I am changing the original code though...

The combo box currently will have for instance:

100
200
300
...
I want to change it to:
100 | Test 1
200 | Test 2
300 | Test 3

However, only the code should populate the combo box. The problem is that the user needs to see the name, but I have to have the code for SQL reasons. Does that make sense?

Thanks,

MDA
 
Can't you jst use the SQL code as the value for the select and use the text as the user friendly value I.E.
<option value=&quot;100>Test 1</option>
 


MDA,

<option value=&quot;100&quot;>100 | Test 1</option>
<option value=&quot;200&quot;>200 | Test 2</option>
<option value=&quot;300&quot;>300 | Test 3</option>
<option value=&quot;400&quot;>400 | Test 4</option>


fengshui_1998
 
Thanks for the input guys,

This is much more complex than expected because it is pulling from a database.. The selected item had to be only the code, not both code and name. I have it working thanks after a few all niters.

Thanks again.
MDA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top