Question

I need to indent some dropdownlist item texts to right based upon a condition. For this I simply add blank space to the left of those item text, however they don't get rendered and the texts get trimmed. Here's what I've tried so far:

  1. Left padded certain texts right in the database (the dropdown list is populated from database)
  2. item.Text=" "+item.Text;
  3. item.Text="   "+item.Text;

None of the above methods work. What is the proper way of doing this? I don't want to go CSS.

Here is the jsfiddle

Was it helpful?

Solution

I think this is more a HTML then ASP.NET issue. In HTML spaces are trimmed between elements. The spec determined that 'non-significant' whitespace must be removed.

You have to use   to make a 'significant' whitespace which will be rendered when at the start or end of an element.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top