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;
}
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;
}
相关文章推荐
- Gridview记录为空时显示表头,和没有记录的提示
- GridView绑定数据源,无记录时表头也显示的一种解决方法
- GridView绑定数据源时无记录时也显示表头
- asp.net Gridview、Repeater 查无数据时显示表头及提示信息
- 数据源为空时如何让GridView显示表头和提示
- GridView绑定数据源,无记录时表头也显示的一种解决方法
- 收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 为什么有时候ASP在插入一条记录时,它会在数据里面插入两条一样的记录?
- GridView数据绑定时数据源为空时显示表头和"没有记录"
- C#.net 添加一行记录,在gridview中显示一条记录。添加多条记录,在gridview中显示多条记录
- GridView绑定数据源,无记录时表头也显示的一种解决方法
- 数据源为空时让GridView显示表头和提示
- 数据源为空GridView显示表头和提示
- GridView绑定数据源,无记录时表头也显示的一种解决方法
- GridView绑定数据源,无记录时表头也显示的一种解决方法
- 无记录时显示gridview表头,并增加一行显示“没有记录”【绑定SqlDataSource控件时】
- GridView绑定数据源,无记录时表头也显示的一种解决方法
- 好几条记录只是仓位及数量不同,其它内容都一样,现在要显示出一条来,仓位及数量用"/"分开
- GridView绑定数据源,无记录时表头也显示的一种解决方法
- GridView绑定数据源,无记录时表头也显示的一种解决方法
- GridView绑定记录为空显示表头