Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

dropdownlist binding


Hi

i am binding the data selected from database to dropdownlist.
 
select companynumber, companyname from company
 
dropdownlist.datatextfield = "companyname"
dropdownlist.datavaluefield = "companynumber"
dropdownlist.databind().
 
with this code in the drop down list i will have companynames.
 
what i want is both companyname - companynumber in dropdownlist.
when i am saying dropdownlist.datatextfield = "companyname" & "companynumber" its
throwing error. is there any other way to do it.
0
sandeep437
Asked:
sandeep437
  • 2
1 Solution
 
tomv011397Commented:
you will need to get that into the query, The 'auto wire up' does not support multiple of user defined fields.

Change your query to

select companyname + " - " + companynumber as displayname
,       CompanyNumber
from ... etc

then link 'displayname' as the display field

TOm
0
 
iamtgo3Commented:
If you bind it to a field on your query it is hard to add two fields together. You can query the database for the fills and then add to dropdown with a for loop.

I realize these are not the greatest examples but should help steer you in the right direction.

George - www.ipdg3.com
0
 
natlozCommented:
TOm is correct...change your select statement to include the concatenated value for your combo box.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now