Reputation:
I am using Linq-to-SQL, and when I select my record to show in gridview my gridview shows empty records. I can see the row but they are empty
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;
}
Upvotes: 1
Views: 145
Reputation: 107
Try having columns in your gridview and bind each individual property of your record to each column. Like Record.documentNumber, Record.fixPaperNumber
etc.
Upvotes: 0
Reputation: 63317
Turn all the fields of your class to properties. Only properties are exposed. Like this:
public class showFacReq {
public string documentNumber {get;set;}
//do the same for others
//....
}
Upvotes: 5