Groups | Blog | Home
all groups > asp.net webcontrols > november 2003 >

asp.net webcontrols : Indent Items in a Web Forms ListBox


Mike parris
11/29/2003 3:30:39 AM
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
Mike parris
11/29/2003 6:33:09 AM
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

[quoted text, click to view]
Jos
11/29/2003 1:01:43 PM
[quoted text, click to view]

Have you tried adding the spaces in HTML-encode form: "&nbsp;" ?

--

Jos

AddThis Social Bookmark Button