dropdownlist: 2 columns in the DataTextField

Discussion in 'ASP .Net' started by nicholas, Dec 3, 2004.

  1. nicholas

    nicholas Guest

    I would like to view 2 columns of my datatable in my dropdownlist.

    Now I have:

    mydropdown.datasource = myDataTable.defaultview
    mydropdown.DataValueField = "optionID"
    mydropdown.DataTextField = "optionnameFR"

    so I just see the "optionnameFR" in the dropdownlist.

    and I would like to have this:

    mydropdown.datasource = myDataTable.defaultview
    mydropdown.DataValueField = "optionID"
    mydropdown.DataTextField = "optionnameFR" &
    "optionprice"

    So I would see for example: "gift wrap +2euro" in the dropdowntextfield.

    So it does not have to be 2 columns, but the data of 2 columns should be on
    1 line

    THX for help,
    Nic
     
    nicholas, Dec 3, 2004
    #1
    1. Advertising

  2. nicholas

    Marina Guest

    This question was asked just yesterday.

    "nicholas" <> wrote in message
    news:...
    > I would like to view 2 columns of my datatable in my dropdownlist.
    >
    > Now I have:
    >
    > mydropdown.datasource = myDataTable.defaultview
    > mydropdown.DataValueField = "optionID"
    > mydropdown.DataTextField = "optionnameFR"
    >
    > so I just see the "optionnameFR" in the dropdownlist.
    >
    > and I would like to have this:
    >
    > mydropdown.datasource = myDataTable.defaultview
    > mydropdown.DataValueField = "optionID"
    > mydropdown.DataTextField = "optionnameFR" &
    > "optionprice"
    >
    > So I would see for example: "gift wrap +2euro" in the dropdowntextfield.
    >
    > So it does not have to be 2 columns, but the data of 2 columns should be

    on
    > 1 line
    >
    > THX for help,
    > Nic
    >
    >
     
    Marina, Dec 3, 2004
    #2
    1. Advertising

  3. nicholas

    nicholas Guest

    could you tell me which topic it was or send a link.
    I can't find.

    THX


    "Marina" <> wrote in message
    news:...
    > This question was asked just yesterday.
    >
    > "nicholas" <> wrote in message
    > news:...
    > > I would like to view 2 columns of my datatable in my dropdownlist.
    > >
    > > Now I have:
    > >
    > > mydropdown.datasource = myDataTable.defaultview
    > > mydropdown.DataValueField = "optionID"
    > > mydropdown.DataTextField = "optionnameFR"
    > >
    > > so I just see the "optionnameFR" in the dropdownlist.
    > >
    > > and I would like to have this:
    > >
    > > mydropdown.datasource = myDataTable.defaultview
    > > mydropdown.DataValueField = "optionID"
    > > mydropdown.DataTextField = "optionnameFR" &
    > > "optionprice"
    > >
    > > So I would see for example: "gift wrap +2euro" in the dropdowntextfield.
    > >
    > > So it does not have to be 2 columns, but the data of 2 columns should be

    > on
    > > 1 line
    > >
    > > THX for help,
    > > Nic
    > >
    > >

    >
    >
     
    nicholas, Dec 3, 2004
    #3
  4. nicholas

    Marina Guest

    I am reading through OE, I have no link. It is something like
    'concatenating multiple values for datavaluefield'. Searching for keywords
    on google groups would probably bring up answers from many similar posts.

    "nicholas" <> wrote in message
    news:%230fg7$...
    > could you tell me which topic it was or send a link.
    > I can't find.
    >
    > THX
    >
    >
    > "Marina" <> wrote in message
    > news:...
    > > This question was asked just yesterday.
    > >
    > > "nicholas" <> wrote in message
    > > news:...
    > > > I would like to view 2 columns of my datatable in my dropdownlist.
    > > >
    > > > Now I have:
    > > >
    > > > mydropdown.datasource = myDataTable.defaultview
    > > > mydropdown.DataValueField = "optionID"
    > > > mydropdown.DataTextField = "optionnameFR"
    > > >
    > > > so I just see the "optionnameFR" in the dropdownlist.
    > > >
    > > > and I would like to have this:
    > > >
    > > > mydropdown.datasource = myDataTable.defaultview
    > > > mydropdown.DataValueField = "optionID"
    > > > mydropdown.DataTextField = "optionnameFR" &
    > > > "optionprice"
    > > >
    > > > So I would see for example: "gift wrap +2euro" in the

    dropdowntextfield.
    > > >
    > > > So it does not have to be 2 columns, but the data of 2 columns should

    be
    > > on
    > > > 1 line
    > > >
    > > > THX for help,
    > > > Nic
    > > >
    > > >

    > >
    > >

    >
    >
     
    Marina, Dec 3, 2004
    #4
  5. I think you can solve this with your SQL SELECT query...something like this:

    "SELECT optionnameFR + ' &nbsp;' + optionprice AS OptionInfo, optionID ,
    optionnameFR from ..."

    mydropdown.DataTextField = "OptionInfo"



    "nicholas" <> wrote in message
    news:...
    >I would like to view 2 columns of my datatable in my dropdownlist.
    >
    > Now I have:
    >
    > mydropdown.datasource = myDataTable.defaultview
    > mydropdown.DataValueField = "optionID"
    > mydropdown.DataTextField = "optionnameFR"
    >
    > so I just see the "optionnameFR" in the dropdownlist.
    >
    > and I would like to have this:
    >
    > mydropdown.datasource = myDataTable.defaultview
    > mydropdown.DataValueField = "optionID"
    > mydropdown.DataTextField = "optionnameFR" &
    > "optionprice"
    >
    > So I would see for example: "gift wrap +2euro" in the dropdowntextfield.
    >
    > So it does not have to be 2 columns, but the data of 2 columns should be
    > on
    > 1 line
    >
    > THX for help,
    > Nic
    >
    >
     
    Ken Cox [Microsoft MVP], Dec 3, 2004
    #5
  6. nicholas

    nicholas Guest

    seems to work, but as my price is an integer, he doesn't want to concatenate
    a string with an integer.
    I tried Ctype (...,...) in the sal statement, but that doesn't work.
    How could I fix this?
    THX

    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:...
    > I think you can solve this with your SQL SELECT query...something like

    this:
    >
    > "SELECT optionnameFR + ' &nbsp;' + optionprice AS OptionInfo, optionID ,
    > optionnameFR from ..."
    >
    > mydropdown.DataTextField = "OptionInfo"
    >
    >
    >
    > "nicholas" <> wrote in message
    > news:...
    > >I would like to view 2 columns of my datatable in my dropdownlist.
    > >
    > > Now I have:
    > >
    > > mydropdown.datasource = myDataTable.defaultview
    > > mydropdown.DataValueField = "optionID"
    > > mydropdown.DataTextField = "optionnameFR"
    > >
    > > so I just see the "optionnameFR" in the dropdownlist.
    > >
    > > and I would like to have this:
    > >
    > > mydropdown.datasource = myDataTable.defaultview
    > > mydropdown.DataValueField = "optionID"
    > > mydropdown.DataTextField = "optionnameFR" &
    > > "optionprice"
    > >
    > > So I would see for example: "gift wrap +2euro" in the dropdowntextfield.
    > >
    > > So it does not have to be 2 columns, but the data of 2 columns should be
    > > on
    > > 1 line
    > >
    > > THX for help,
    > > Nic
    > >
    > >

    >
     
    nicholas, Dec 3, 2004
    #6
    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. Angela
    Replies:
    2
    Views:
    2,133
    David Wier
    Jun 7, 2004
  2. Parodi Development
    Replies:
    0
    Views:
    3,676
    Parodi Development
    Sep 10, 2004
  3. Sam
    Replies:
    1
    Views:
    12,101
    Eliyahu Goldin
    Feb 18, 2005
  4. jobs
    Replies:
    0
    Views:
    490
  5. Mark Rae
    Replies:
    5
    Views:
    5,378
    Mark Rae
    Jan 12, 2007
Loading...

Share This Page