datagrid绑定list没有数据 表头不显示的解决方法
程序员文章站
2024-03-01 12:16:34
复制代码 代码如下:var list = pt_orderworkflow_dao.getorderworkflow(wfid, uid, 1); ...
复制代码 代码如下:
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>();