views:

400

answers:

1

I have an ASP.NET DropDownList control that retrieves the first and last name from a column in the database. Instead of having just one space between the first and last name, I want there to be three. How do I add the extra spaces between the two pieces of text in the DropDownList?

+2  A: 

Add   instead of space character, and HtmlDecode all elements after binding :

string[] items = new string[] { 
    "name& nbsp;& nbsp;& nbsp;surname1", 
    "name& nbsp;& nbsp;& nbsp;surname2" };

ddl.DataSource = items;
ddl.DataBind();

foreach (ListItem item in ddl.Items)
{
    item.Text = HttpUtility.HtmlDecode(item.Text);
}
Canavar