gridview 添加多行表头

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

Table table = (Table)this.GridView1.Controls[0];
int realIndex = table.Rows.GetRowIndex(e.Row);
GridView oGridView = (GridView)sender;
GridViewRow oGridViewRow = new GridViewRow(realIndex, realIndex, DataControlRowType.Separator, DataControlRowState.Normal);
TableCell oTableCell = new TableCell();
oGridViewRow.Cells.Add(oTableCell);
table.Controls.AddAt(realIndex, oGridViewRow);

}
}

你可能感兴趣的:(GridView)