我正在使用 Linq-to-SQL,当我选择要在 gridview 中显示的记录时,我的 gridview 显示空记录。我可以看到该行,但它们是空的
public class showFacReq
{
public string documentNumber;
public string fixPaperNumber;
public string letterDate;
public string letterNumber;
public string propertyFactoryCenteralId;
public string requestId;
public string year;
}
public List<showFacReq> ShowFactoryRequset()
{
List<showFacReq> q = (from i in dbconnect.tblFactoryRequests.AsEnumerable()
select new showFacReq
{
documentNumber = i.documentNumber,
fixPaperNumber = i.fixPaperNumber,
letterDate =ConvertToPersianToShow(i.letterDate),
letterNumber = i.letterNumber,
propertyFactoryCenteralId = i.propertyFactoryCenteralId,
requestId = i.requestId.ToString(),
year = i.year
}).ToList();
return q;
}
最佳答案
将类的所有字段都转为属性。仅公开属性。像这样:
public class showFacReq {
public string documentNumber {get;set;}
//do the same for others
//....
}
关于c# - Gridview 显示空行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20199784/