Based on the experience of the DataGrid, you can define a style in the style sheet and specify the cssclass of the header, row, and interval rows to get the desired effect. Later, after the gridview took over the DataGrid, it was found that there were always some inlistening places, and it was solved by setting the field attribute. Today, this problem is bothering me again. Just these days I have been very interested in exploring details, and it is really hard to help.
Originally, when the gridview generates HTML, the header corresponds to the th mark, and the row corresponds to the TD mark. For th, the default style is center bold. For TD, the default style is left normal. Even if you define and apply the style: Text-align: Left; In headerstyle, the header is still centered. This is because the style is applied to tr When HTML is generated, for example, <tr class = 'gridhead'> <TH> </Th> </tr>, the Header style you applied in this way cannot take effect.
If you have defined: TR {text-align: Left} in the style sheet, you can display the header to the left, but if you want to center some columns, the definition of horizontalalign = "center" is invalid.
After finding out the cause of the problem, you can flexibly grasp the problem based on the actual application. For example, if you want to change the default display of the header to the left, you can define Th {text-align: Left;} in the style sheet. If some columns need to be centered, you can define a class, for example. mycenter {text-algin: center;}, set
Please note that the gridhead style applied to the Black tag is added to the <tr> tag after HTML is generated, and the green tag can take effect.