E
Eric Layman
Hi
I am attempting to bind data to a dropdownlist. Currently the below code
will bind a persons last name just find using the datatextfield. What I
would like to do though, is also be able to bind there First Name as well
into that datatextfield, so that when the drop down list is displayed, they
see a Last Name, First Name, rather than just a persons last name.
cmdname = New SqlClient.SqlCommand("SELECT id, lname, fname from
app_personal", conn)
dtrname = cmdname.ExecuteReader()
ddlname.DataSource = dtrname
ddlname.DataTextField = "lname"
ddlname.DataValueField = "id"
ddlname.DataBind()
dtrname.Close()
Any help would be much appreciated.
Are there any other ways apart from the sql method?..eg: New
SqlClient.SqlCommand("SELECT id, lname, fname, rtrim(fname) + ' ' +
rtrim(lname) as fullname from app_personal", conn)
Pls advise.
Thanks
I am attempting to bind data to a dropdownlist. Currently the below code
will bind a persons last name just find using the datatextfield. What I
would like to do though, is also be able to bind there First Name as well
into that datatextfield, so that when the drop down list is displayed, they
see a Last Name, First Name, rather than just a persons last name.
cmdname = New SqlClient.SqlCommand("SELECT id, lname, fname from
app_personal", conn)
dtrname = cmdname.ExecuteReader()
ddlname.DataSource = dtrname
ddlname.DataTextField = "lname"
ddlname.DataValueField = "id"
ddlname.DataBind()
dtrname.Close()
Any help would be much appreciated.
Are there any other ways apart from the sql method?..eg: New
SqlClient.SqlCommand("SELECT id, lname, fname, rtrim(fname) + ' ' +
rtrim(lname) as fullname from app_personal", conn)
Pls advise.
Thanks