I have:
Id
, FName
, LName
. Id
, Full Name
. Where Full Name
column is combination of FName
and LName
. How can the Full Name
column of DataGrid can be bound to two Data Source columns ( FName
and LName
) without any string manipulation?
You could add a new column to the datatable
eg:
private void DGTest_gridBind()
{
DataTable table = new DataTable();
table.Columns.Add("FName", typeof(string));
table.Columns.Add("LName", typeof(string));
table.Columns.Add("FullName", typeof(string), "FName + ' ' + LName");
table.Rows.Add("Jack", "Miller");
table.Rows.Add("Sam", "Tucker");
DGTest.DataSource = table;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.