Solution to gridview multi-Header

Source: Internet
Author: User

For example, the headers 13-1 to 13-11 are also dynamically bound.

 

 

Protected void gridview1_rowcreated (Object sender, gridviewroweventargs e) {If (E. row. rowtype = datacontrolrowtype. header) {tablecellcollection tcheader = E. row. cells; // obtain all the units of the row in the table header, tcheader. clear (); // clear the original header information tableheadercell th = NULL; // For (INT I = 1; I <= 10; I ++) {// simulate the creation of 10 sub-columns th = new tableheadercell (); th. TEXT = "scheme_" + I; th. width = 80; tcheader. add (th);} gridviewrow rowheader = new gridviewrow (0, 0, datacontrolrowtype. header, datacontrolrowstate. normal); // create a table header row tableheadercell 22. type = new tableheadercell (); th2.rowspan = 2; th2.text = "date"; th2.width = 100; rowheader. cells. add (2nd); // 2nd = new tableheadercell (); th2.columnspan = 10; th2.text = "Departure plan"; rowheader. cells. add (2nd); // 2nd = new tableheadercell (); th2.rowspan = 2; th2.text = "modify"; rowheader. cells. add (2nd); (gridview) sender ). controls [0]. controls. addat (0, rowheader); // Add to the first row of the gridview, that is, the header }}

 

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.