GridView当中插入一条空记录,显示其它提示一下表头语句
GridView 显示内空如下:编号 部门 金额
1 A部 1000
2 B部 1200
3 C部 1000
4 D部 1200我想改成这样的格式如何实现?
当编号=2 时增加 编号 部门 金额 这行数据编号 部门 金额
1 A部 1000
2 B部 1200
编号 部门 金额
3 C部 1000
4 D部 1200谢谢!
GridView 显示内空如下:编号 部门 金额
1 A部 1000
2 B部 1200
3 C部 1000
4 D部 1200我想改成这样的格式如何实现?
当编号=2 时增加 编号 部门 金额 这行数据编号 部门 金额
1 A部 1000
2 B部 1200
编号 部门 金额
3 C部 1000
4 D部 1200谢谢!
谢谢!
fengwuleann 请问一下插入空行如何插入空行呢?
for (int j = 0; j < numCols; j++)
{
TableCell cell = new TableCell();
cell.Text = "编号";
row.Cells.Add(cell);
}
GridView1.Controls[0].Controls.AddAt(numCount + 1 + i, row);需要适当的修改,因为你每次循环cell.Text 的值都不同
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;
}