Table header layering in gridview

Source: Internet
Author: User

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;

}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.