Literal space in a DropDownList

Discussion in 'ASP .Net' started by Jon Sagara, Sep 10, 2004.

  1. Jon Sagara

    Jon Sagara Guest

    I'm trying to insert space characters into some ListItems in a DropDownList.
    However, ASP.NET is converting my " " into " ". Anyone know
    how to insert literal spaces when populating a DDL programmatically?

    --
    Jon Sagara
    Jon Sagara, Sep 10, 2004
    #1
    1. Advertising

  2. Jon Sagara

    Shiva Guest

    Did you try adding the space chars directly without   ?
    Eg: DropdownList.Items.Add (" ");

    "Jon Sagara" <> wrote in message
    news:#...
    I'm trying to insert space characters into some ListItems in a DropDownList.
    However, ASP.NET is converting my "&nbsp;" into "&amp;nbsp;". Anyone know
    how to insert literal spaces when populating a DDL programmatically?

    --
    Jon Sagara
    Shiva, Sep 10, 2004
    #2
    1. Advertising

  3. Jon Sagara

    Jon Sagara Guest

    Yep. Just like in an HTML page, they are not rendered as spaces.

    I have a temporary workaround -- instead of spaces, I am using dashes.

    Thanks,

    --
    Jon Sagara



    "Shiva" <> wrote in message
    news:...
    > Did you try adding the space chars directly without &nbsp; ?
    > Eg: DropdownList.Items.Add (" ");
    >
    > "Jon Sagara" <> wrote in message
    > news:#...
    > I'm trying to insert space characters into some ListItems in a

    DropDownList.
    > However, ASP.NET is converting my "&nbsp;" into "&amp;nbsp;". Anyone know
    > how to insert literal spaces when populating a DDL programmatically?
    >
    > --
    > Jon Sagara
    >
    >
    >
    Jon Sagara, Sep 10, 2004
    #3
  4. You could resolve this problem by using Server.HTMLDecode.
    For example, when you add a new item to the list that should be displayed
    as "1 3", you use

    DropDownList1.Items.Add(Server.HtmlDecode("1&nbsp;&nbsp;3"));

    This should solve your problem.
    Regards
    Mohamed El Ashmawy
    MEA Developer Support Center
    ITWorx on behalf of Microsoft EMEA GTSC
    Mohamed El Ashmawy, Sep 13, 2004
    #4
  5. Jon Sagara

    azman

    Joined:
    Feb 26, 2008
    Messages:
    1
    I had the same problem. My SQL data source is SQL2000, and all I did was pre-pend char(160) to the field I wanted to indent. For example: select char(160) +<fieldname> from <table>. That worked.
    azman, Feb 26, 2008
    #5
    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. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,883
    Bryan Bullard
    Jul 11, 2003
  2. Christian Seberino
    Replies:
    21
    Views:
    1,643
    Stephen Horne
    Oct 27, 2003
  3. Ian Bicking
    Replies:
    2
    Views:
    1,005
    Steve Lamb
    Oct 23, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    716
    Michael Hudson
    Oct 24, 2003
  5. Anonieko Ramos

    What's wrong with rpc-literal? Why use doc-literal?

    Anonieko Ramos, Sep 27, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    371
    Anonieko Ramos
    Sep 27, 2004
Loading...

Share This Page