Indent Items in a Web Forms ListBox

Discussion in 'ASP .Net Web Controls' started by Mike parris, Nov 29, 2003.

  1. Mike parris

    Mike parris Guest

    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, Nov 29, 2003
    #1
    1. Advertising

  2. Mike parris

    Jos Guest

    "Mike parris" <> wrote in message
    news:065801c3b66c$373a0ba0$...
    > 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: "&nbsp;" ?

    --

    Jos
     
    Jos, Nov 29, 2003
    #2
    1. Advertising

  3. Mike parris

    Mike parris Guest

    GOT IT

    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

    >-----Original Message-----
    >"Mike parris" <> wrote

    in message
    >news:065801c3b66c$373a0ba0$...
    >> 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: " " ?
    >
    >--
    >
    >Jos
    >
    >
    >.
    >
     
    Mike parris, Nov 29, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kent
    Replies:
    1
    Views:
    881
    Andrew de la Harpe
    May 3, 2004
  2. K B
    Replies:
    2
    Views:
    670
  3. dt
    Replies:
    4
    Views:
    494
    CBFalconer
    Dec 31, 2006
  4. Tomas
    Replies:
    1
    Views:
    574
    Munna
    Aug 12, 2008
  5. lotusshiv

    Indent text items in a ListBox Web Control in ASP.Net 1.0

    lotusshiv, Apr 27, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    249
    lotusshiv
    Apr 27, 2006
Loading...

Share This Page