Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert whitespace between characters in listbox

I am trying to insert items into a listbox in my asp.net C# application

I concatenate some values and put whitespace in between them but it doesn't show up in the listbox.

        ListItem lt = new ListItem();
        lt.Text = ItemName + "    " + barcode + "    " + price; // problem
        lt.Value = barcode;
        lstMailItems.Items.Add(lt);

i even tried

lt.Text = ItemName + "\t\t" + barcode + "\t\t" + price; // problem
lt.Text = ItemName + "& nbsp;" + barcode + "& nbsp;" + price; // &nbsp shows up as text

but that even doesn't seem to work. How can I put whitespace between these strings so that it shows up in the listbox as well

like image 562
Jaelebi Avatar asked Feb 28 '23 11:02

Jaelebi


1 Answers

string spaces = Server.HtmlDecode("    "); 

lt.Text = ItemName + spaces + barcode + spaces + price; // works
like image 136
Jaelebi Avatar answered Mar 06 '23 11:03

Jaelebi