I'm pretty sure the will get encoded by asp.net and turn into the
literam  
so you'd end up with
Canada
  Ontario
  Quebect
You need HtmlDecode the  . I like to use a utility function:
private void Page_Load(object sender, EventArgs e)
{
ddl.Items.Add("Canada");
ddl.Items.Add(Padding(2) + "Ontario");
ddl.Items.Add(Padding(2) + "Quebec");
ddl.Items.Add(Padding(2) + "PEI");
}
public static string Padding(int count)
{
if (count == 0)
{
return string.Empty;
}
string[] s = new string[count];
for (int i = 0; i < count; ++i)
{
s[i] = " ";
}
return HttpUtility.HtmlDecode(string.Join("", s));
}
Or, even better, create a custom server control which you can easily use
like a normal dropdownlist:
public class PaddedDropDownList : DropDownList
{
protected override void Render(HtmlTextWriter writer)
{
foreach (ListItem item in Items)
{
item.Text = item.Text.Replace(" ",
HttpUtility.HtmlDecode(" "));
}
base.Render(writer);
}
}
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"=?Utf-8?B?SmVmZg==?=" <Je**@discussions.microsoft.com> wrote in
news:BC**********************************@microsof t.com:
Help....
I have formatted a lsit of strings to add to a dropdownlist to shows
three colums: id, description and price.
i.e.
123 description here $12.95
12456 another description $123.01
But when the text is rendered the white space is removed so it looks
like this:
123 descripion here $12.95
12456 another description $123.01
It's a long list and I would like the values to line up. Is there a
way to keep the control from removing the white space?
I tried a list box and it does the same thing.
Is there another control that would do the job?
Try: Replace(" ", " ", MyItem.text)
See if that works...
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
Newmarket Volvo Sucks! http://newmarketvolvo.tripod.com