I have a grid view to which I bind data in to the grid view using a linq query. I need to add a separate column to that grid view. How can I add it?
I used the query shown below:
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();
Add another one property to your anonymous class:
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();
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.