Workaround for DROPDOWNLIST issue?

Discussion in 'ASP .Net' started by Eliyahu Goldin, Dec 15, 2004.

  1. Try nonbreaking spaces  

    Eliyahu

    "buc" <> wrote in message
    news:...
    > Does anyone know a workaround for the issue with the dropdownlist control

    of
    > space trucation after databinding.
    > ex. a simple databind of a stored proc from SQL server .
    > SELECT field1 + ' - ' + field2 as myvalue from table
    >
    > 'field1 is JOHN
    > 'field2 is DOE
    >
    > 'code snippet with a datareader
    > SQLcmd.CommandType = CommandType.StoredProcedure
    > SQLcmd.CommandText = myStoredProcName
    > dReader = SQLcmd.ExecuteReader()
    > drpdwnlst.DataSource = dReader
    > drpdwnlst.DataTextField = dReader.GetName(0) 'or "myvalue"
    > drpdwnlst.DataBind()
    >
    > displays JOHN-DOE with spaces 'erased' instead of JOHN - DOE
    > doesn't matter how many spaces are put between fields or field type, all
    > spaces are 'trimmed' during databind.
    >
    > Thanks, BUC
    >
    >
    >
     
    Eliyahu Goldin, Dec 15, 2004
    #1
    1. Advertising

  2. Eliyahu Goldin

    Jo Inferis Guest

    Eliyahu Goldin wrote:
    > Try nonbreaking spaces &nbsp;


    I was going to suggest something like that, but figured I'd actually test it
    before posting - it doesn't work.

    This *is* an HTML issue though, nothing to do with .NET whatsoever.

    You can add :

    option { white-space : pre }

    to the page stylesheet, and in FireFox this will show the options as
    intended, but the selected item will always be displayed wrong. The style
    isn't understood (for this tag at least) in IE though.

    --
    jo inferis
     
    Jo Inferis, Dec 15, 2004
    #2
    1. Advertising

  3. Eliyahu Goldin

    buc Guest

    Does anyone know a workaround for the issue with the dropdownlist control of
    space trucation after databinding.
    ex. a simple databind of a stored proc from SQL server .
    SELECT field1 + ' - ' + field2 as myvalue from table

    'field1 is JOHN
    'field2 is DOE

    'code snippet with a datareader
    SQLcmd.CommandType = CommandType.StoredProcedure
    SQLcmd.CommandText = myStoredProcName
    dReader = SQLcmd.ExecuteReader()
    drpdwnlst.DataSource = dReader
    drpdwnlst.DataTextField = dReader.GetName(0) 'or "myvalue"
    drpdwnlst.DataBind()

    displays JOHN-DOE with spaces 'erased' instead of JOHN - DOE
    doesn't matter how many spaces are put between fields or field type, all
    spaces are 'trimmed' during databind.

    Thanks, BUC
     
    buc, Dec 15, 2004
    #3
  4. Eliyahu Goldin

    buc Guest

    I don't think this is possible, it just gives
    JOHN-&nbsp;DOE

    with SELECT field1 + ' - &nbsp; ' + field2 as myvalue
    from table

    "Eliyahu Goldin" <> wrote in message
    news:...
    > Try nonbreaking spaces &nbsp;
    >
    > Eliyahu
    >
    > "buc" <> wrote in message
    > news:...
    >> Does anyone know a workaround for the issue with the dropdownlist control

    > of
    >> space trucation after databinding.
    >> ex. a simple databind of a stored proc from SQL server .
    >> SELECT field1 + ' - ' + field2 as myvalue from table
    >>
    >> 'field1 is JOHN
    >> 'field2 is DOE
    >>
    >> 'code snippet with a datareader
    >> SQLcmd.CommandType = CommandType.StoredProcedure
    >> SQLcmd.CommandText = myStoredProcName
    >> dReader = SQLcmd.ExecuteReader()
    >> drpdwnlst.DataSource = dReader
    >> drpdwnlst.DataTextField = dReader.GetName(0) 'or "myvalue"
    >> drpdwnlst.DataBind()
    >>
    >> displays JOHN-DOE with spaces 'erased' instead of JOHN - DOE
    >> doesn't matter how many spaces are put between fields or field type, all
    >> spaces are 'trimmed' during databind.
    >>
    >> Thanks, BUC
    >>
    >>
    >>

    >
    >
     
    buc, Dec 15, 2004
    #4
    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. Nigil LaVey

    intellisense for aspx workaround?

    Nigil LaVey, Mar 4, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    418
    Nigil LaVey
    Mar 4, 2004
  2. Phil Streiff

    DropDownlist SelectedIndex zero-based workaround??

    Phil Streiff, Apr 8, 2004, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    238
    Scott
    Apr 8, 2004
  3. JV
    Replies:
    0
    Views:
    234
  4. Replies:
    3
    Views:
    123
  5. Replies:
    12
    Views:
    174
Loading...

Share This Page