1. Overall appearance adjustment:
Width widths
Gridline Grid line Settings
Showfooter If table footer is displayed
Showheader whether the header is displayed
Showheaderwhenempty If no data is present, the header is displayed
Emptydatatext If no data is detected, the prompt text is displayed.
HeaderStyle the style of the header
FooterStyle style of footnotes
RowStyle style of line
AlternatingRowStyle style of alternating rows
SelectedRowStyle the style of the selected row
EditRowStyle editing the style of a row
The above 6 styles can be set with the CssClass property, which can be set as a style in the style sheet
2. Adjustment of columns:
The smart menu in the upper-right corner--Edit Columns--Fields window.
3. Adjustment of the line:
How rows are generated: line-by-row creation, line-by-row binding.
Create-create layout, appearance, static text.
Bind--Put the corresponding data in the data source into the corresponding lattice.
Two events:
RowCreated each row creates a trigger.
RowDataBound each line is bound to the end of the trigger.
In both of these events, there is a GridViewRowEventArgs parameter e:
E.rowtype type of line: Header,footer,datarow,pager
E.rowstate State of the Line (DataRow): Normal,alternate,selected,edit
E.row.dataitem data, the data object to which the current row is bound.
E.row.cells the appearance of the cell in the current row.
if(E.row.rowtype = = Datacontrolrowtype.datarow)//determines whether the row is a data row{Info Data=(Info) E.row.dataitem; if(Data. Birthday.Value.Year >=1985)//Judging{e.row.font.bold=true;//The line font is bolde.row.cells[4]. Font.Italic =true;//font tilt in the fifth grid } }
Data Control (GridView)