Data Control (GridView)

Source: Internet
Author: User

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)

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.