private void CreateTitle()
{
Table table = (Table)GridView1.Controls[0];
GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);
TableCell cell1 = new TableCell(); cell1.RowSpan = 2; cell1.Text = "编号";
TableCell cell2 = new TableCell(); cell2.RowSpan = 2; cell2.Text = "企业名称";
TableCell cell3 = new TableCell(); cell3.RowSpan = 2; cell3.Text = "法人代表";
TableCell cell4 = new TableCell(); cell4.ColumnSpan = 2; cell4.Text = "注册监理工程师";
TableCell cell6 = new TableCell(); cell6.RowSpan = 2; cell6.Text = "资质证书编号";
TableCell cell7 = new TableCell(); cell7.RowSpan = 2; cell7.Text = "资质等级";
TableCell cell8 = new TableCell(); cell8.RowSpan = 2; cell8.ColumnSpan = 2; cell8.Text = "编辑";
row.Cells.Add(cell1);
row.Cells.Add(cell2);
row.Cells.Add(cell3);
row.Cells.Add(cell4);
row.Cells.Add(cell6);
row.Cells.Add(cell7);
row.Cells.Add(cell8);
row.CssClass = "GridViewHeaderTD";
table.Rows.Add((TableRow)row);
GridViewRow row1 = new GridViewRow(1, -1, DataControlRowType.Header, DataControlRowState.Normal);
TableCell cell11 = new TableCell(); cell11.Text = "一级";
TableCell cell12 = new TableCell(); cell12.Text = "二级";
row1.Cells.Add(cell11);
row1.Cells.Add(cell12);
row1.CssClass = "GridViewHeaderTD";
table.Rows.Add((TableRow)row1);
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
CreateTitle();
e.Row.Visible = false;
}
}