Workaround for DROPDOWNLIST issue?

J

Jo Inferis

Eliyahu said:
Try nonbreaking spaces  

I was going to suggest something like that, but figured I'd actually test it
before posting - it doesn't work.

This *is* an HTML issue though, nothing to do with .NET whatsoever.

You can add :

option { white-space : pre }

to the page stylesheet, and in FireFox this will show the options as
intended, but the selected item will always be displayed wrong. The style
isn't understood (for this tag at least) in IE though.
 
B

buc

Does anyone know a workaround for the issue with the dropdownlist control of
space trucation after databinding.
ex. a simple databind of a stored proc from SQL server .
SELECT field1 + ' - ' + field2 as myvalue from table

'field1 is JOHN
'field2 is DOE

'code snippet with a datareader
SQLcmd.CommandType = CommandType.StoredProcedure
SQLcmd.CommandText = myStoredProcName
dReader = SQLcmd.ExecuteReader()
drpdwnlst.DataSource = dReader
drpdwnlst.DataTextField = dReader.GetName(0) 'or "myvalue"
drpdwnlst.DataBind()

displays JOHN-DOE with spaces 'erased' instead of JOHN - DOE
doesn't matter how many spaces are put between fields or field type, all
spaces are 'trimmed' during databind.

Thanks, BUC
 
B

buc

I don't think this is possible, it just gives
JOHN- DOE

with SELECT field1 + ' -   ' + field2 as myvalue
from table
 

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,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top