DataGrid multi-layer header design

Source: Internet
Author: User
DataGrid multi-layer header design

Author: UnknownSource: Moonlight software Station Time added: 2005-6-5 moonlight software Station

Recently I used the DataGrid multi-layer table header. I asked a lot of people and I felt that the answer was not very clear. I summarized it myself and hoped that I would avoid detours for the future developers.

Similar to the above situation, at first glance, I thought it was necessary to implement it through table, but I believe that the powerful DataGrid is

Is to start searching for methods. Some predecessors explain that tableheadercell is added to tablecellcollection (this should be the foundation

Content ).

The figure is in the traditional Chinese format.

<Asp: DataGrid id = "userdg" onitemcreated = "maid"

Public sub datagrid1_itemcreated (byval sender as object, byval e

System. Web. UI. webcontrols. datagriditemeventargs)
If E. Item. itemtype = listitemtype. header then
Dim TCl as tablecellcollection = E. Item. Cells
TCL. Clear ()
TCL. Add (New tableheadercell)
TCL (0). rowspan = 2
TCL (0). Text = "personal code"

TCL. Add (New tableheadercell)
TCL (1). rowspan = 2
TCL (1). Text = "gender"

TCL. Add (New tableheadercell)
TCL (2). rowspan = 2
TCL (2). Text = "name"

TCL. Add (New tableheadercell)
TCL (3). rowspan = 2
TCL (3). Text = "service <br> times"

TCL. Add (New tableheadercell)
TCL (4). rowspan = 2
TCL (4). Text = "User <br> modify"

TCL. Add (New tableheadercell)
TCL (5). rowspan = 2
TCL (5). Text = "Health <br> List"

TCL. Add (New tableheadercell)
TCL (6). columnspan = 4
TCL (6). Text = "personal disease risk assessment </TD> <TD colspan = '1' rowspan = '2' align = center

Valign = middle bgcolor = '#0082c6'> <font color = '# ffff'> management <br> prescription </font> </TD> <TD

Rowspan = '2' align = center valign = middle bgcolor = '#0082c6'> <font color = '# ffff'> summary <br> report

</Font> </TD> <TD rowspan = '2' align = center valign = middle bgcolor = '#0082c6'> <font

Color = '# ffff'> highlights <br> tip </font> </TD> </tr> <TD bgcolor =' #848284 'align = 'center'

Valign = 'ddle'> <font color = '# ffff'> diabetes </font> </TD> <TD bgcolor =' #848284 'align = 'center'

Valign = 'midddle'> <font color = '# ffff'> stroke </font> </TD> <TD bgcolor =' #848284 'align = 'center'

Valign = 'midddle'> <font color = '# ffff'> Coronary Heart Disease </font> </TD> <TD bgcolor =' #100'

Align = 'center' valign = 'middle'> <font color = '# ffff'> lung cancer </font>"

End if
End sub 'maid _ itemcreated
The key part is
TCL. Add (New tableheadercell)
TCL (6). columnspan = 4
TCL (6). Text = "personal disease risk assessment </TD> <TD colspan = '1' rowspan = '2' align = center

Valign = middle bgcolor = '#0082c6'> <font color = '# ffff'> management <br> prescription </font> </TD> <TD

Rowspan = '2' align = center valign = middle bgcolor = '#0082c6'> <font color = '# ffff'> summary <br> report

</Font> </TD> <TD rowspan = '2' align = center valign = middle bgcolor = '#0082c6'> <font

Color = '# ffff'> highlights <br> tip </font> </TD> </tr> <TD bgcolor =' #848284 'align = 'center'

Valign = 'ddle'> <font color = '# ffff'> diabetes </font> </TD> <TD bgcolor =' #848284 'align = 'center'

Valign = 'midddle'> <font color = '# ffff'> stroke </font> </TD> <TD bgcolor =' #848284 'align = 'center'

Valign = 'midddle'> <font color = '# ffff'> Coronary Heart Disease </font> </TD> <TD bgcolor =' #100'

align = 'center' valign = 'middle'> lung cancer "
myself the steps are as follows: now the structure is designed in the table, and then the double quotation marks are converted into single quotation marks and added to tableheadercell. text. Multiple complex operations can be implemented.
I hope it will be helpful to those who will not use the DataGrid multi-layer header design!

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.