Grid View Appearance Customization
- 2 minutes to read
You can customize ASPxGridView appearance in multiple ways:
Cascading Style Sheet (CSS) Classes
Use cascading style sheet (CSS) classes. CSS styles define how elements are rendered, as well as their position on the page. This provides you with centralized control over the appearance of several controls or the entire web site. ASPxGridView ships with a number of predefined themes. You can also create your own themes.
Built-in Styles
You can customize the appearance of individual elements or the entire grid with ASPxGridView built-in styles. Each style property has a number of attributes that allow you to customize element appearance to the maximum extent allowed by web browsers. These attributes include: colors, font, borders, content alignment, text attributes, and so on.
Use the ASPxGridView.Styles property to access these styles. To access the styles used to paint the pager, grid editors, and the Filter Control, use the ASPxGridView.StylesPager, ASPxGridView.StylesEditors, and ASPxGridBase.StylesFilterControl properties, respectively.
You can use grid column styles to draw column headers (GridViewColumn.HeaderStyle), data and footer cells (GridViewColumn.CellStyle and GridViewColumn.FooterCellStyle), and more. These styles override corresponding ASPxGridView styles.
Conditional Formatting
The grid allows you to customize the appearance of individual cells and/or rows. In this instance, handle the ASPxGridView.HtmlDataCellPrepared and/or ASPxGridView.HtmlRowPrepared events, and specify style settings used to paint required cells and/or rows. See the following topic for an example: How to: Change the Style Settings of Individual Data Cells.