Binding two data columns to DataTextField

Discussion in 'ASP .Net' started by Angela, Jun 7, 2004.

  1. Angela

    Angela Guest

    Hi everyone,

    Is it possible to bind the DataTextField property to two values from a
    database.

    I would like the text from column("book") and the text from
    column("code") to appear in the DataTextField of a dropdown.

    If this is not possible is there are work around?


    Thanks


    Angela
     
    Angela, Jun 7, 2004
    #1
    1. Advertisements

  2. Angela

    Ben Guest

    I'm sure there are many approaches to this, but I would do it inside
    OnItemDataBind. Create a datarowview, and process information as necessary.
    "Angela" <> wrote in message
    news:...
    > Hi everyone,
    >
    > Is it possible to bind the DataTextField property to two values from a
    > database.
    >
    > I would like the text from column("book") and the text from
    > column("code") to appear in the DataTextField of a dropdown.
    >
    > If this is not possible is there are work around?
    >
    >
    > Thanks
    >
    >
    > Angela
     
    Ben, Jun 7, 2004
    #2
    1. Advertisements

  3. Angela

    David Wier Guest

    You can accomplish this easily by creating the item displayed in your SQL
    statement:
    Select book + ' ' + code as BookCode from (YourTableName)
    Then, use 'BookCode' as your DataTextField

    David Wier
    MCP, MVP ASP.NET, ASPInsider
    http://aspnet101.com
    http://aspexpress.com


    "Angela" <> wrote in message
    news:...
    > Hi everyone,
    >
    > Is it possible to bind the DataTextField property to two values from a
    > database.
    >
    > I would like the text from column("book") and the text from
    > column("code") to appear in the DataTextField of a dropdown.
    >
    > If this is not possible is there are work around?
    >
    >
    > Thanks
    >
    >
    > Angela
     
    David Wier, Jun 7, 2004
    #3
    1. Advertisements

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. Jordan
    Replies:
    2
    Views:
    2,766
    Jordan
    Feb 10, 2004
  2. Simon Harvey

    Binding two columns to a DropDownList

    Simon Harvey, Jun 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,725
    Rick Spiewak
    Jun 27, 2004
  3. nicholas
    Replies:
    5
    Views:
    16,076
    nicholas
    Dec 3, 2004
  4. GenxLogic
    Replies:
    3
    Views:
    1,979
    andrewmcdonagh
    Dec 6, 2006
  5. Daniel Caetano

    binding data to datagrid(template columns)

    Daniel Caetano, Feb 27, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    207
    Daniel Caetano
    Feb 27, 2004
  6. quiggle

    Binding Two DataTable Columns to One DataGrid Column

    quiggle, Apr 2, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    283
    quiggle
    Apr 2, 2004
  7. JcFx
    Replies:
    0
    Views:
    541
  8. Paul Turley

    Binding Image data type columns

    Paul Turley, May 18, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    287
    Ken Cox [Microsoft MVP]
    May 19, 2004
Loading...