datagrid绑定list没有数据 表头不显示的解决方法
内容摘要
复制代码 代码如下:var list = Pt_OrderWorkFlow_DAO.GetOrderWorkFlow(wfid, uid, 1); if (list == null) { list = new List<Pt_OrderWor
文章正文
复制代码 代码如下:
var list = Pt_OrderWorkFlow_DAO.GetOrderWorkFlow(wfid, uid, 1);
if (list == null)
{
list = new List<Pt_OrderWorkFlow>();
}
dgWaitList.DataSource = list;
dgWaitList.DataBind();
可以直接这样比较优雅了
复制代码 代码如下:
OADataContext db = DatabaseHelper.GetDB();
var rs = (from a in db.Pt_OrderWorkFlow
where a.WFID == wfID && a.ContractNumber == cNumber
select a).ToList<Pt_OrderWorkFlow>();
return rs.Count() > 0 ? rs : new List<Pt_OrderWorkFlow>();
代码注释