Indent Items in a Web Forms ListBox

M

Mike parris

I want to represent the list of items as a heirarchy by
indenting each item by a set amount depending on its level.
For example level 1 = no spaces, level 1 = 2 spaces etc.

If I try too use leading spaces or tabs to do this the
control removes them. Is there a way to do this?

Mike
 
J

Jos

Mike parris said:
I want to represent the list of items as a heirarchy by
indenting each item by a set amount depending on its level.
For example level 1 = no spaces, level 1 = 2 spaces etc.

If I try too use leading spaces or tabs to do this the
control removes them. Is there a way to do this?

Have you tried adding the spaces in HTML-encode form: " " ?
 
M

Mike parris

Thanks for the reply. Here's the solution.

In the ASDPX page (as you suggested) -
<P><asp:listbox id="L" runat="server" >
<asp:ListItem>&nbsp;&nbsp;&nbsp;Item 1</asp:ListItem>
</asp:listbox></P>

In VB code (the one I really wanted) -
L.Items.Add(Server.HtmlDecode("&nbsp;&nbsp;&nbsp;Item 2"))

In Vb code you need to use the function HtmlDecode.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top