Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Workaround for DROPDOWNLIST issue?

Reply
Thread Tools

Workaround for DROPDOWNLIST issue?

 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      12-15-2004
Try nonbreaking spaces  

Eliyahu

"buc" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
 
 
 
Jo Inferis
Guest
Posts: n/a
 
      12-15-2004
Eliyahu Goldin wrote:
> Try nonbreaking spaces &nbsp;


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.

--
jo inferis


 
Reply With Quote
 
 
 
 
buc
Guest
Posts: n/a
 
      12-15-2004
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



 
Reply With Quote
 
buc
Guest
Posts: n/a
 
      12-15-2004
I don't think this is possible, it just gives
JOHN-&nbsp;DOE

with SELECT field1 + ' - &nbsp; ' + field2 as myvalue
from table

"Eliyahu Goldin" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Try nonbreaking spaces &nbsp;
>
> Eliyahu
>
> "buc" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView: Filter DropDownList for another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-29-2005 07:44 AM
GridView: Filtr DropDownList from another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-23-2005 01:31 PM
databinding a Dropdownlist to another dropdownlist tshad ASP .Net 8 10-19-2005 10:00 PM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM
DropDownlist SelectedIndex zero-based workaround?? Phil Streiff ASP .Net Web Controls 5 04-08-2004 08:19 PM



Advertisments