This works great EXCEPT VB is removing the spaces from the string. I build
the string with a SQL statement
select field1 + ' - ' + field2 from table
This returns XXX - YYYY for example (verified by just reading the
strings). HOWEVER, when VB places this string in the combo box, It trims the
spaces between the XXX and YYYY and leaves the string
XXX-YYYY. It always does this. This is crazy. It does it on every machine I
try it on, (diff developemnt computers too). Whats going on? I have no TRIM
statments, NO FORMAT statements in the combobox properties. It is directly
bound!! Thanks!!
BUC
A combobox does not have a DataTextField, that is a property from a
dropdownlist.
Windowforms controls cannot be loaded directly from a datareader as webform
controls can.
Your code looks completly as webform code by the way however there does the
combobox not exist.
So it is strange it works "great"
And please don't call something a bug before you know it is, because you
could have said as well, "is the problem that it is raining here". The only
thing it is telling it "I have to less knowledge to solve this problem".
However say that than and don't accusse others who made those controls.
Browser will toss extra spaces in HTML. I am pretty sure that is what you
are seeing.
You may have to replace your spaces with codes. But don't quote me
on that! (That will be tricky to do without using a loop and manually
adding items to the dropdown box.
untested:
Do while dReader.Read
combobox1.Items.Add(New ListItem(dReader(0).Value.Replace(" ", " "),
dReader(1).Value)
Loop
Maybe a misunderstanding, my apologies..it is in a webform, with a
'dropdownlist', not a 'combo' type box. However, I have contacted Microsoft
and this is a reproducible issue using the dropdownlist in a webform. Maybe
a fix sometimes in the future. O Well...
Buc
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.