I'd like to bind a ComboBox
to a DataTable
(I cannot alter its original schema)
cbo.DataSource = tbldata;
cbo.DataTextField = "Name";
cbo.DataValueField = "GUID";
cbo.DataBind();
I want the ComboBox
show tbldata.Name + tbldata.Surname
.
Of course adding the new name+surname as a field to the tbldata
just before binding is possible, but I am hoping for a more elegant solution along the lines of (pseudocode)
cbo.DataTextField = "Name";
cbo.DataTextField += "Surname";
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…