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; //   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
string spaces = Server.HtmlDecode(" ");
lt.Text = ItemName + spaces + barcode + spaces + price; // works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With