您的位置:首页 > 编程语言 > ASP

asp.net GridView 后台绑定数据无数据显示表头及没有数据一行

2014-07-01 15:33 633 查看
IList<类名> lists = 类名Manager.GetAll();

var listgrid = (from v in lists

where v.State == state

select v).Skip(pageindex * pagesize).Take(pagesize);

//没有数据的时候,GridView添加一条新行,内容为没有数据

if (listgrid.Count() == 0)

{

int cols = this.gvLists.Columns.Count;

this.gvLists.Rows[0].Cells.Clear();

this.gvLists.Rows[0].Cells.Add(new TableCell());

this.gvLists.Rows[0].Cells[0].ColumnSpan = cols;

this.gvLists.Rows[0].Cells[0].Text = "没有数据";

this.gvLists.Rows[0].Cells[0].Style.Add("text-align", "center");

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: