walle
walle

Reputation: 33

dropdownlist with datatable

I have a dropdownlist and I load a value from the database

Protected Sub Popola_ddl_menu()
    Dim ds As New dsMenu
    Dim ta As New dsMenuTableAdapters.tb_menuTableAdapter
    ta.Fill(ds.tb_menu)
    ddl_lista_gruppi.DataSource = ds.tb_menu

    ddl_lista_gruppi.DataTextField = "Etichetta"
    ddl_lista_gruppi.DataValueField = "Etichetta"
    ddl_lista_gruppi.DataBind()


End Sub

.... I should insert two values ​​but I always fail if concatenate another field for example

ddl_lista_gruppi.DataTextField = "Etichetta" & "blabla" 

Can You help me?

Upvotes: 0

Views: 69

Answers (1)

Bibhu
Bibhu

Reputation: 4081

You can achieve it in this manner, you can add the two columns in your SQL query to create a new column and use that for the DataTextFeild value. For example like this :

SELECT lastname + ', ' + firstname AS Name FROM employees

You can also check out this MSDN link.

Upvotes: 1

Related Questions