本帖最后由 顾 于 2021-4-25 12:53 编辑
DataTable DT = new DataTable("TEST TABLE FOR DEMO PURPOSES");
DT.Columns.AddRange(
new DataColumn[]
{
new DataColumn("Id", typeof(int)),
new DataColumn("SomePropertyOrColumnName", typeof(string)),
new DataColumn("Description", typeof(string)),
});
DT.Rows.Add(1, "AAAA", "AAAAA");
DT.Rows.Add(2, "BBBB", "BBBBB");
DT.Rows.Add(3, "CCCC", "CCCCC");
DT.Rows.Add(3, "DDDD", "DDDDD");
cmbDataTableDataSource.DataSource =
new ListSelectionWrapper<DataRow>(
DT.Rows,
"SomePropertyOrColumnName" // "SomePropertyOrColumnName" will populate the Name on ObjectSelectionWrapper.
);
cmbDataTableDataSource.DisplayMemberSingleItem = "Name";
cmbDataTableDataSource.DisplayMember = "NameConcatenated";
cmbDataTableDataSource.ValueMember = "Selected";
如何获取Id?
|
|