The custom header of the GridView and the custom header of the gridview.
// Modify the header
Protected void GridView1_RowCreated (object sender, GridViewRowEventArgs e)
{
Switch (e. Row. RowType)
{
Case DataControlRowType. Header:
TableCellCollection tcHeader = e. Row. Cells;
TcHeader. Clear ();
// Header of the first line
TcHeader. Add (new TableHeaderCell ());
TcHeader [0]. Text = "date ";
TcHeader [0]. Attributes. Add ("rowspan", "2 ");
TcHeader. Add (new TableHeaderCell ());
TcHeader [1]. Text = "Week ";
TcHeader [1]. Attributes. Add ("rowspan", "2 ");
TcHeader. Add (new TableHeaderCell ());
TcHeader [2]. Text = "White shift ";
TcHeader [2]. Attributes. Add ("colspan", "2 ");
TcHeader. Add (new TableHeaderCell ());
TcHeader [3]. Text = "night shift </th> </tr> <tr> ";
TcHeader [3]. Attributes. Add ("colspan", "2 ");
// The header of the second row
TcHeader. Add (new TableHeaderCell ());
TcHeader [4]. Text = "name ";
TcHeader. Add (new TableHeaderCell ());
TcHeader [5]. Text = "department ";
TcHeader. Add (new TableHeaderCell ());
TcHeader [6]. Text = "name ";
TcHeader. Add (new TableHeaderCell ());
TcHeader [7]. Text = "department ";
Break;
}
}