Right align text in a DropDownList

Discussion in 'ASP .Net Web Controls' started by Joel, Jan 11, 2005.

  1. Joel

    Joel Guest

    I have data from a table that must be strings, not numbers, but I would like
    to display it in a DropDownList WebControl right aligned. I tried using the
    DataTextFormatString but with no luck. Any ideas?

    TIA

    </joel>
    Joel, Jan 11, 2005
    #1
    1. Advertising

  2. Sadly, you do not have much control over the display of text in a
    DropDownList in ASP.NET, HTML or CSS.
    One method that you could try would be to pad the strings with preceding
    spaces to make it appear as if they were right-aligned.

    --
    Philip Q
    Microsoft MVP [ASP.NET]

    "Joel" <> wrote in message
    news:ewjyktB%...
    >I have data from a table that must be strings, not numbers, but I would
    >like to display it in a DropDownList WebControl right aligned. I tried
    >using the DataTextFormatString but with no luck. Any ideas?
    >
    > TIA
    >
    > </joel>
    >
    Philip Q [MVP], Jan 12, 2005
    #2
    1. Advertising

  3. Joel

    Jens Ansorg Guest

    Joel wrote:
    > I have data from a table that must be strings, not numbers, but I would like
    > to display it in a DropDownList WebControl right aligned. I tried using the
    > DataTextFormatString but with no luck. Any ideas?
    >


    its one of the many shortcomings of internet explorer

    try this little sample in IE and then in Mozilla/Firefox and then go and
    complain to Balmer/Gates ;)


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>DD text align test</title>
    </head>

    <body>

    <select style="text-align:right;">
    <option style="text-align:right;">asdds</option>
    <option style="text-align:right;">ds asdfd as </option>
    <option style="text-align:right;">tt tet</option>
    </select>

    </body>
    </html>
    Jens Ansorg, Jan 14, 2005
    #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. Kay
    Replies:
    2
    Views:
    7,146
  2. tshad

    text-align vs align

    tshad, Jun 23, 2005, in forum: HTML
    Replies:
    1
    Views:
    1,254
    David Dorward
    Jun 23, 2005
  3. Steve Richter
    Replies:
    1
    Views:
    896
    Mark Rae
    Jun 24, 2007
  4. Bogdan
    Replies:
    1
    Views:
    783
    Bogdan
    Jun 16, 2009
  5. Oran
    Replies:
    2
    Views:
    532
Loading...

Share This Page