Today, a problem occurs when using the gridview. I have several fields in the header that span two rows, but several fields that only Span one row. The solution is as follows:
Protected void gridview1_rowcreated (Object sender, gridviewroweventargs E)
{
If (E. Row. rowtype = datacontrolrowtype. header)
{
String strtitle = @ "<tr> <TD rowspan = '2'> water source name </TD>"; // rowspan indicates the number of different rows.
Strtitle = strtitle + @ "<TD rowspan = '2'> water source code </TD> ";
Strtitle = strtitle + @ "<TD rowspan = '2'> water delivery method </TD> ";
Strtitle = strtitle + @ "<TD rowspan = '2'> whether storage adjustment facilities exist </TD> ";
Strtitle = strtitle + @ "<TD rowspan = '2'> water delivery length </TD> ";
Strtitle = strtitle + @ "<TD colspan = '6' align = 'center'> water purification plant processing technology </TD> </tr>"; // colspan indicates the number of different columns.
Strtitle = strtitle + @ "<TD> precipitation </TD> ";
Strtitle = strtitle + @ "<TD> filter </TD> ";
Strtitle = strtitle + @ "<TD> disinfect </TD> ";
Strtitle = strtitle + @ "<TD> enhanced deep processing </TD> ";
Strtitle = strtitle + @ "<TD> special processing technology for algae-containing water </TD> ";
Strtitle = strtitle + @ "<TD> others </TD> </tr> ";
Tablecellcollection tcheader = E. Row. cells;
Tcheader. Clear ();
Tcheader. Add (New tablecell ());
Tcheader [0]. Text = strtitle;
}
}