dropdownlist: 2 columns in the DataTextField

N

nicholas

I would like to view 2 columns of my datatable in my dropdownlist.

Now I have:

mydropdown.datasource = myDataTable.defaultview
mydropdown.DataValueField = "optionID"
mydropdown.DataTextField = "optionnameFR"

so I just see the "optionnameFR" in the dropdownlist.

and I would like to have this:

mydropdown.datasource = myDataTable.defaultview
mydropdown.DataValueField = "optionID"
mydropdown.DataTextField = "optionnameFR" &
"optionprice"

So I would see for example: "gift wrap +2euro" in the dropdowntextfield.

So it does not have to be 2 columns, but the data of 2 columns should be on
1 line

THX for help,
Nic
 
M

Marina

I am reading through OE, I have no link. It is something like
'concatenating multiple values for datavaluefield'. Searching for keywords
on google groups would probably bring up answers from many similar posts.
 
K

Ken Cox [Microsoft MVP]

I think you can solve this with your SQL SELECT query...something like this:

"SELECT optionnameFR + '  ' + optionprice AS OptionInfo, optionID ,
optionnameFR from ..."

mydropdown.DataTextField = "OptionInfo"
 
N

nicholas

seems to work, but as my price is an integer, he doesn't want to concatenate
a string with an integer.
I tried Ctype (...,...) in the sal statement, but that doesn't work.
How could I fix this?
THX
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top