我有一个网格视图,我使用linq查询将数据绑定到网格视图。我需要在该网格视图中添加一个单独的列。我该如何添加它?
我使用了如下所示的查询:
DataTable dt = Common.dc.TblIssueDetails.Where(id => id.AssetId ==
LeAsset.EditValue.getInteger()).Select(id => new
{
Select=false,
id.TblStoreStock.TblStock.TblItem.ItemName,
id.TblIssueMaster.IssueDate,
Quantity=0
}).getDataTable();
答案 0 :(得分:0)
将另一个属性添加到匿名类:
DataTable dt = Common.dc.TblIssueDetails.Where(id => id.AssetId ==
LeAsset.EditValue.getInteger()).Select(id => new
{
Select=false,
id.TblStoreStock.TblStock.TblItem.ItemName,
id.TblIssueMaster.IssueDate,
Quantity=0,
SomeSeparateColumnName = someData // someData is data that you want to write to separate column.
}).getDataTable();