Problem with DropDownList

A

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.
 
N

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.
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top