Hello,
I am having trouble populating the DataTextField of a CheckBox List with data from more than one field of a database. If I only use one field it works fine, but as soon as i add a second I receive and error. Here is a sample of the code (using
vb.net)
strSQL = ""
strSQL += " select id, firstname, lastname"
strSQL += " from approvers"
objConn = New SqlConnection(strConn)
objAdapter = New SqlDataAdapter(strSQL, objConn)
objAdapter.Fill(objDS, "approver")
cblApprovers.DataSource = objDS.Tables("approver").DefaultView
cblApprovers.DataTextField = "lastname" & ", " & "firstname"
cblApprovers.DataValueField = "id"
cblApprovers.DataBind()
If I just use "firstname" or "lastname" it run fine. I am hoping to populate a checkbox list that will show like this
"<lastname>, <firstname>"
Can you please assist?
Thanks
Craig Jones