populate data to dropdowlist

Discussion in 'ASP .Net Web Controls' started by susie, Oct 28, 2003.

  1. susie

    susie Guest

    I have following code to populate a downdownlist
    dynamically:
    Dim myCmd As SqlCommand = New SqlCommand("SELECT LName,
    FName FROM Manager", con)

    Dim myReader As SqlDataReader = myCmd.ExecuteReader()


    dropdown1.DataSource = myReader
    dropdown1.DataValueField = "LName"
    dropdown1.DataBind()


    How can I populate dropdown1 with both FName and LName?
    I tried
    dropdown1.DataValueField = "LName"&" "&"FName"

    It does not work.

    Please help.

    Thank you!
    susie, Oct 28, 2003
    #1
    1. Advertising

  2. susie

    seamad Guest

    What was the solution?

    I have the same problem, pls let me know the solution
    >-----Original Message-----
    >I have following code to populate a downdownlist
    >dynamically:
    >Dim myCmd As SqlCommand = New SqlCommand("SELECT LName,
    >FName FROM Manager", con)
    >
    >Dim myReader As SqlDataReader = myCmd.ExecuteReader()
    >
    >
    > dropdown1.DataSource = myReader
    > dropdown1.DataValueField = "LName"
    > dropdown1.DataBind()
    >
    >
    >How can I populate dropdown1 with both FName and LName?
    >I tried
    >dropdown1.DataValueField = "LName"&" "&"FName"
    >
    >It does not work.
    >
    >Please help.
    >
    >Thank you!
    >.
    >
    seamad, Oct 29, 2003
    #2
    1. Advertising

  3. susie

    Guest Guest

    What was the solution?

    change your SQL statement to "SELECT LName+FName Name FROM
    Manager" and change the code to
    dropdown1.DataValueField = "Name"
    Good luck!
    >-----Original Message-----
    >I have the same problem, pls let me know the solution
    >>-----Original Message-----
    >>I have following code to populate a downdownlist
    >>dynamically:
    >>Dim myCmd As SqlCommand = New SqlCommand("SELECT LName,
    >>FName FROM Manager", con)
    >>
    >>Dim myReader As SqlDataReader = myCmd.ExecuteReader()
    >>
    >>
    >> dropdown1.DataSource = myReader
    >> dropdown1.DataValueField = "LName"
    >> dropdown1.DataBind()
    >>
    >>
    >>How can I populate dropdown1 with both FName and LName?
    >>I tried
    >>dropdown1.DataValueField = "LName"&" "&"FName"
    >>
    >>It does not work.
    >>
    >>Please help.
    >>
    >>Thank you!
    >>.
    >>

    >.
    >
    Guest, Oct 29, 2003
    #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. Chris Kettenbach

    Get a handle on a dropdowlist?

    Chris Kettenbach, Oct 17, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    367
    =?Utf-8?B?U3JlZWppdGggUmFt?=
    Oct 17, 2005
  2. Lupakkiotto

    Dropdowlist in a gridview in edit mode

    Lupakkiotto, Nov 11, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,699
    Lupakkiotto
    Nov 11, 2005
  3. =?Utf-8?B?Ymx1ZWxhYnM=?=

    DROPDOWLIST PROBLEM

    =?Utf-8?B?Ymx1ZWxhYnM=?=, Mar 29, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    337
    =?Utf-8?B?Ymx1ZWxhYnM=?=
    Mar 30, 2007
  4. Dropdowlist within a datagrid, (VB.NET)

    , Feb 1, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    147
    Scott M.
    Feb 2, 2005
  5. Enjoy Life
    Replies:
    2
    Views:
    253
    Roland Hall
    Feb 23, 2005
Loading...

Share This Page