Solved

dropdownlist binding

Posted on 2004-09-09
7
318 Views
Last Modified: 2010-04-23

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
Comment
Question by:sandeep437
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
tomv011397 earned 125 total points
ID: 12018842
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
 
LVL 1

Expert Comment

by:iamtgo3
ID: 12019396
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
 
LVL 7

Expert Comment

by:natloz
ID: 12019999
TOm is correct...change your select statement to include the concatenated value for your combo box.
0
 
LVL 1

Expert Comment

by:iamtgo3
ID: 12020048
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question