Grids, dropdown, sql queries and extra spaces

Discussion in 'ASP .Net Datagrid Control' started by eagle, Aug 22, 2005.

  1. eagle

    eagle Guest

    I have a sql query that combines 2 fields to end up as one, and binds to a
    dropdown list in a grid. I want to add spaces into the qry so the fields
    look like the are separate. But the drop down list seems to trim any extra
    spaces, and it displays any html codes I put in there. Does anyone know how
    to do this?
    This is what I want displayed in the drop down list, with a significant
    amount of space between the date and the currency:

    01/01/05 12.00
    01/02/05 13.00

    This is what I've tried:

    select Convert(varchar, datBillDate, 1) + '     ' +
    Convert(varchar, curAmountOwed) as ddldisplay from tbl

    select Convert(varchar, datBillDate, 1) + '     ' +
    Convert(varchar, curAmountOwed) as ddldisplay from tbl

    Result: 01/01/05      12.00

    select Convert(varchar, datBillDate, 1) + Char(9) + Char(9) + Char(9) +
    Char(9) + Convert(varchar, curAmountOwed) as ddldisplay from tbl

    Result (displays as just one space): 01/01/05 12.00

    I've tried using Char(32) also.

    Any other ideas?
    eagle, Aug 22, 2005
    #1
    1. Advertising

  2. eagle

    Sagar Guest

    Please try SPACE and see if that works..

    "eagle" <> wrote in message
    news:...
    >I have a sql query that combines 2 fields to end up as one, and binds to a
    > dropdown list in a grid. I want to add spaces into the qry so the fields
    > look like the are separate. But the drop down list seems to trim any
    > extra spaces, and it displays any html codes I put in there. Does anyone
    > know how to do this?
    > This is what I want displayed in the drop down list, with a significant
    > amount of space between the date and the currency:
    >
    > 01/01/05 12.00
    > 01/02/05 13.00
    >
    > This is what I've tried:
    >
    > select Convert(varchar, datBillDate, 1) + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
    > + Convert(varchar, curAmountOwed) as ddldisplay from tbl
    >
    > select Convert(varchar, datBillDate, 1) + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'
    > + Convert(varchar, curAmountOwed) as ddldisplay from tbl
    >
    > Result: 01/01/05&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12.00
    >
    > select Convert(varchar, datBillDate, 1) + Char(9) + Char(9) + Char(9) +
    > Char(9) + Convert(varchar, curAmountOwed) as ddldisplay from tbl
    >
    > Result (displays as just one space): 01/01/05 12.00
    >
    > I've tried using Char(32) also.
    >
    > Any other ideas?
    >
    >
    >
    >
    >
    Sagar, Aug 23, 2005
    #2
    1. Advertising

  3. eagle

    eagle Guest

    That was a good idea, but it didn't work either.

    "Sagar" <> wrote in message
    news:...
    > Please try SPACE and see if that works..
    >
    > "eagle" <> wrote in message
    > news:...
    >>I have a sql query that combines 2 fields to end up as one, and binds to a
    >> dropdown list in a grid. I want to add spaces into the qry so the fields
    >> look like the are separate. But the drop down list seems to trim any
    >> extra spaces, and it displays any html codes I put in there. Does anyone
    >> know how to do this?
    >> This is what I want displayed in the drop down list, with a significant
    >> amount of space between the date and the currency:
    >>
    >> 01/01/05 12.00
    >> 01/02/05 13.00
    >>
    >> This is what I've tried:
    >>
    >> select Convert(varchar, datBillDate, 1) +
    >> '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + Convert(varchar, curAmountOwed) as
    >> ddldisplay from tbl
    >>
    >> select Convert(varchar, datBillDate, 1) +
    >> '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + Convert(varchar, curAmountOwed) as
    >> ddldisplay from tbl
    >>
    >> Result: 01/01/05&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;12.00
    >>
    >> select Convert(varchar, datBillDate, 1) + Char(9) + Char(9) + Char(9) +
    >> Char(9) + Convert(varchar, curAmountOwed) as ddldisplay from tbl
    >>
    >> Result (displays as just one space): 01/01/05 12.00
    >>
    >> I've tried using Char(32) also.
    >>
    >> Any other ideas?
    >>
    >>
    >>
    >>
    >>

    >
    >
    eagle, Aug 23, 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. topmind

    Dynamic SQL handling, and edit-grids?

    topmind, May 2, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,262
    topmind
    May 2, 2006
  2. Ian Roddis

    xslt queries in xml to SQL queries

    Ian Roddis, Feb 26, 2006, in forum: Python
    Replies:
    3
    Views:
    1,497
    Crutcher
    Feb 26, 2006
  3. ecoolone
    Replies:
    0
    Views:
    754
    ecoolone
    Jan 3, 2008
  4. mathieu
    Replies:
    3
    Views:
    594
    Bo Persson
    Sep 4, 2009
  5. Abby Lee

    so many queries within queries I'm confused

    Abby Lee, Aug 4, 2004, in forum: ASP General
    Replies:
    11
    Views:
    351
    Aaron [SQL Server MVP]
    Aug 6, 2004
Loading...

Share This Page