Groups | Blog | Home
all groups > asp.net webcontrols > october 2003 >

asp.net webcontrols : populate data to dropdowlist


susie
10/28/2003 9:34:47 AM
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.

seamad
10/28/2003 10:56:16 PM
I have the same problem, pls let me know the solution
[quoted text, click to view]
anonymous NO[at]SPAM discussions.microsoft.com
10/29/2003 6:21:34 AM
change your SQL statement to "SELECT LName+FName Name FROM
Manager" and change the code to
dropdown1.DataValueField = "Name"
Good luck!
[quoted text, click to view]
AddThis Social Bookmark Button