您的位置:首页 > 其它

GridView当中插入一条空记录,显示其它提示一下表头

2008-09-07 16:57 316 查看
DataTable dt = GetTable();//把gettable()换成你自己的数据就可以了

if (GetTable().Rows.Count == 0)

{

dt.Rows.Add(dt.NewRow());

this.GridView1.DataSource = dt;

GridView1.DataBind();

int columnCount = GridView1.Rows[0].Cells.Count;

GridView1.Rows[0].Cells.Clear();

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

GridView1.Rows[0].Cells[0].ColumnSpan = columnCount;

GridView1.Rows[0].Cells[0].Text = "无符合数据,请重新设定搜索条件.";

GridView1.Rows[0].Cells[0].ForeColor = System.Drawing.Color.Red;

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