How do I bind a ComboBox so the displaymember is concat of 2 fields of source datatable?

后端 未结 7 1990
既然无缘
既然无缘 2020-12-01 18:03

I\'d like to bind a ComboBox to a DataTable (I cannot alter its original schema)

cbo.DataSource = tbldata;
cbo.DataTextField = \"Na         


        
7条回答
  •  萌比男神i
    2020-12-01 18:28

    Have a property in your class that is the concat of Name and Surname. And bind the DataTextField to this property.

    In case you are binding it to a DataTable, you can add a new column to the DataTable whose values are concat of Name and Surname and bind it to the combo.

提交回复
热议问题