Home All Groups Group Topic Archive Search About
Author
21 Mar 2006 6:41 PM
APatel
DropDownList is automatically trimming the string but i wanted to append the
space with the string value in the dropdownlist (C# ASP.NET).

Is there any way to add space since the dropdownlist automatically trims the
stringvariable ?

Following are the things which i already tried :
1)
I tried adding leftPad and RightPad property of the string but it doesnt work.
2)
I also tried appending "                "  space to the  string variable
3)
I tried appending    to the variable string
4)
I tried using class String constructor
Ex: String str = new String(' ',10)
5)
I tried appending "\t" character to the string

All this doesnt work.

Is this a problem with Dropdownlist ?? or is there any way to achieve the
desire result.

Author
21 Mar 2006 10:15 PM
Nathan Sokalski
The problem isn't with DropDownList, it's with the fact that HTML ignores
(in most cases) whitespace. What you need to do is rather than use spaces,
use the HTML character code   instead.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"APatel" <APa***@discussions.microsoft.com> wrote in message
news:A9FE9AF3-7C02-470E-944E-D90A0F4ABAB3@microsoft.com...
> DropDownList is automatically trimming the string but i wanted to append
> the
> space with the string value in the dropdownlist (C# ASP.NET).
>
> Is there any way to add space since the dropdownlist automatically trims
> the
> stringvariable ?
>
> Following are the things which i already tried :
> 1)
> I tried adding leftPad and RightPad property of the string but it doesnt
> work.
> 2)
> I also tried appending "                "  space to the  string variable
> 3)
> I tried appending    to the variable string
> 4)
> I tried using class String constructor
> Ex: String str = new String(' ',10)
> 5)
> I tried appending "\t" character to the string
>
> All this doesnt work.
>
> Is this a problem with Dropdownlist ?? or is there any way to achieve the
> desire result.