protected void gv_test_rowcreated (object sender, GridViewRowEventArgs e)
{
if (E.row.rowtype = = Datacontrolrowtype.header)
{
E.row.setrendermethoddelegate (New Rendermethod (Newrendermethod));
}
}
public void Newrendermethod (HtmlTextWriter writer, Control ctl)
{
//Add header first line
writer. Write ("<td rowspan=/" 2/"align=/" center/"> 12th row of the first column </td>/n");
Writer. Write ("<td rowspan=/" 2/"align=/" center/"> 12th row of the second column </td>/n");
Writer. Write ("<td colspan=/" 3/"align=/" center/"> First row third column, cross second row three column </td>/n");
Writer. Write ("<td colspan=/" 5/"align=/" center/"> First row Fourth column, cross second row five columns </td>/n");
Writer. Write ("<td colspan=/" 5/"align=/" center/"> First row Fifth column, cross second row five columns </td>/n");
Writer. Write ("</tr>/n");
This.gv_WorkLoad.HeaderStyle.AddAttributesToRender (writer);
Add Table Header second row
Writer. RenderBeginTag ("TR");
Because the first second column of the second row is merged with the first second column of the first row, the second row is added starting from the third column
for (int i = 2; i < CTL. Controls.Count; i++)
{
Ctl. Controls[i]. RenderControl (writer);
}
}