Workaround for DROPDOWNLIST issue?

  • Thread starter Thread starter Eliyahu Goldin
  • Start date Start date
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.
 
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
 
I don't think this is possible, it just gives
JOHN- DOE

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