GridViewRow newrow = new GridViewRow(0, 0, DataControlRowType.Separator, DataControlRowState.Normal); TableCell[] tc=new TableCell[5]; for (int i = 0; i < 5; i++) { tc[i] = new TableCell(); } tc[0].Text = (GridView1.Rows.Count + 1).ToString(); tc[1].Text = "第一列内容"; tc[2].Text = "第二列内容"; tc[3].Text = "第三列内容"; tc[4].Text = "第四列内容"; tc[5].Text = "第五列内容"; newrow.Cells.AddRange(tc); GridView1.Controls[0].Controls.AddAt(GridView1.Rows.Count + 1, newrow);
时间: 2024-10-06 02:20:09